Skip to content

Commit 6354019

Browse files
authored
fix(api): API multiple filters (#4322)
1 parent 8d3a5a0 commit 6354019

6 files changed

Lines changed: 359 additions & 611 deletions

File tree

api/spec/packages/aip/src/common/parameters.tsp

Lines changed: 34 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,10 @@ model SortQuery {}
2525
"x-go-type-import",
2626
#{ path: "github.com/openmeterio/openmeter/api/v3/filters" }
2727
)
28-
@oneOf
2928
@summary("Boolean Field Filter")
3029
union BooleanFieldFilter {
31-
@summary("Equals (short form)")
3230
equals: boolean,
33-
34-
@summary("Equals")
35-
BooleanFieldEQFilter: {
31+
object: {
3632
/** Value strictly equals the given boolean value. */
3733
eq: boolean,
3834
},
@@ -48,53 +44,31 @@ union BooleanFieldFilter {
4844
"x-go-type-import",
4945
#{ path: "github.com/openmeterio/openmeter/api/v3/filters" }
5046
)
51-
@oneOf
5247
@summary("Numeric Field Filter")
5348
union NumericFieldFilter {
54-
@summary("Equals (short form)")
5549
equals: float64,
56-
57-
@summary("Equals")
58-
NumericFieldEQFilter: {
50+
object: {
5951
/** Value strictly equals the given numeric value. */
60-
eq: float64,
61-
},
52+
eq?: float64,
6253

63-
@summary("Not Equals")
64-
NumericFieldNEQFilter: {
6554
/** Value does not equal the given numeric value. */
66-
neq: float64,
67-
},
55+
neq?: float64,
6856

69-
@summary("Equals one of")
70-
NumericFieldOEQFilter: {
7157
/** Returns entities that match any of the comma-delimited numeric values. */
7258
@encode(ArrayEncoding.commaDelimited)
73-
oeq: float64[],
74-
},
59+
oeq?: float64[],
7560

76-
@summary("Less Than")
77-
NumericFieldLTFilter: {
7861
/** Value is less than the given numeric value. */
79-
lt: float64,
80-
},
62+
lt?: float64,
8163

82-
@summary("Less Than or Equal To")
83-
NumericFieldLTEFilter: {
8464
/** Value is less than or equal to the given numeric value. */
85-
lte: float64,
86-
},
65+
lte?: float64,
8766

88-
@summary("Greater Than")
89-
NumericFieldGTFilter: {
9067
/** Value is greater than the given numeric value. */
91-
gt: float64,
92-
},
68+
gt?: float64,
9369

94-
@summary("Greater Than or Equal To")
95-
NumericFieldGTEFilter: {
9670
/** Value is greater than or equal to the given numeric value. */
97-
gte: float64,
71+
gte?: float64,
9872
},
9973
}
10074

@@ -108,72 +82,40 @@ union NumericFieldFilter {
10882
"x-go-type-import",
10983
#{ path: "github.com/openmeterio/openmeter/api/v3/filters" }
11084
)
111-
@oneOf
112-
@summary("String Field Filter")
11385
union StringFieldFilter {
114-
@summary("Equals (short form)")
11586
equals: string,
116-
117-
@summary("Equals")
118-
StringFieldEQFilter: {
87+
object: {
11988
/** Value strictly equals the given string value. */
120-
eq: string,
121-
},
89+
eq?: string,
12290

123-
@summary("Not Equals")
124-
StringFieldNEQFilter: {
12591
/** Value does not equal the given string value. */
126-
neq: string,
127-
},
92+
neq?: string,
12893

129-
@summary("Contains")
130-
StringFieldContainsFilter: {
13194
/** Value contains the given string value (fuzzy match). */
132-
contains: string,
133-
},
95+
contains?: string,
13496

135-
@summary("Contains one of")
136-
StringFieldOContainsFilter: {
13797
/** Returns entities that fuzzy-match any of the comma-delimited phrases in the filter string. */
13898
@encode(ArrayEncoding.commaDelimited)
139-
ocontains: string[],
140-
},
99+
ocontains?: string[],
141100

142-
@summary("Equals one of")
143-
StringFieldOEQFilter: {
144101
/** Returns entities that exact match any of the comma-delimited phrases in the filter string. */
145102
@encode(ArrayEncoding.commaDelimited)
146-
oeq: string[],
147-
},
103+
oeq?: string[],
148104

149-
@summary("Greater Than")
150-
StringFieldGTFilter: {
151105
/** Value is greater than the given string value (lexicographic compare). */
152-
gt: string,
153-
},
106+
gt?: string,
154107

155-
@summary("Greater Than or Equal To")
156-
StringFieldGTEFilter: {
157108
/** Value is greater than or equal to the given string value (lexicographic compare). */
158-
gte: string,
159-
},
109+
gte?: string,
160110

161-
@summary("Less Than")
162-
StringFieldLTFilter: {
163111
/** Value is less than the given string value (lexicographic compare). */
164-
lt: string,
165-
},
112+
lt?: string,
166113

167-
@summary("Less Than or Equal To")
168-
StringFieldLTEFilter: {
169114
/** Value is less than or equal to the given string value (lexicographic compare). */
170-
lte: string,
171-
},
115+
lte?: string,
172116

173-
@summary("Exists")
174-
StringFieldExistsFilter: {
175117
/** When true, the field must be present (non-null); when false, the field must be absent (null). */
176-
exists: boolean,
118+
exists?: boolean,
177119
},
178120
}
179121

@@ -187,29 +129,19 @@ union StringFieldFilter {
187129
"x-go-type-import",
188130
#{ path: "github.com/openmeterio/openmeter/api/v3/filters" }
189131
)
190-
@oneOf
191132
@summary("String Field Filter Exact")
192133
union StringFieldFilterExact {
193-
@summary("Equals (short form)")
194134
equals: string,
195-
196-
@summary("Equals")
197-
StringFieldEQFilter: {
135+
object: {
198136
/** Value strictly equals the given string value. */
199-
eq: string,
200-
},
137+
eq?: string,
201138

202-
@summary("Equals one of")
203-
StringFieldOEQFilter: {
204139
/** Returns entities that exact match any of the comma-delimited phrases in the filter string. */
205140
@encode(ArrayEncoding.commaDelimited)
206-
oeq: string[],
207-
},
141+
oeq?: string[],
208142

209-
@summary("Not Equals")
210-
StringFieldNEQFilter: {
211143
/** Value does not equal the given string value. */
212-
neq: string,
144+
neq?: string,
213145
},
214146
}
215147

@@ -223,29 +155,19 @@ union StringFieldFilterExact {
223155
"x-go-type-import",
224156
#{ path: "github.com/openmeterio/openmeter/api/v3/filters" }
225157
)
226-
@oneOf
227158
@summary("ULID Field Filter")
228159
union ULIDFieldFilter {
229-
@summary("Equals (short form)")
230160
equals: Shared.ULID,
231-
232-
@summary("Equals")
233-
ULIDFieldEQFilter: {
161+
object: {
234162
/** Value strictly equals the given ULID value. */
235-
eq: Shared.ULID,
236-
},
163+
eq?: Shared.ULID,
237164

238-
@summary("Equals one of")
239-
ULIDFieldOEQFilter: {
240165
/** Returns entities that exact match any of the comma-delimited ULIDs in the filter string. */
241166
@encode(ArrayEncoding.commaDelimited)
242-
oeq: Shared.ULID[],
243-
},
167+
oeq?: Shared.ULID[],
244168

245-
@summary("Not Equals")
246-
ULIDFieldNEQFilter: {
247169
/** Value does not equal the given ULID value. */
248-
neq: Shared.ULID,
170+
neq?: Shared.ULID,
249171
},
250172
}
251173

@@ -259,40 +181,24 @@ union ULIDFieldFilter {
259181
"x-go-type-import",
260182
#{ path: "github.com/openmeterio/openmeter/api/v3/filters" }
261183
)
262-
@oneOf
263184
@summary("DateTime Field Filter")
264185
union DateTimeFieldFilter {
265-
@summary("Equals (short form)")
266186
equals: Shared.DateTime,
267-
268-
@summary("Equals")
269-
DateTimeFieldEQFilter: {
187+
object: {
270188
/** Value strictly equals given RFC-3339 formatted timestamp in UTC. */
271-
eq: Shared.DateTime,
272-
},
189+
eq?: Shared.DateTime,
273190

274-
@summary("Less Than")
275-
DateTimeFieldLTFilter: {
276191
/** Value is less than the given RFC-3339 formatted timestamp in UTC. */
277-
lt: Shared.DateTime,
278-
},
192+
lt?: Shared.DateTime,
279193

280-
@summary("Less Than or Equal To")
281-
DateTimeFieldLTEFilter: {
282194
/** Value is less than or equal to the given RFC-3339 formatted timestamp in UTC. */
283-
lte: Shared.DateTime,
284-
},
195+
lte?: Shared.DateTime,
285196

286-
@summary("Greater Than")
287-
DateTimeFieldGTFilter: {
288197
/** Value is greater than the given RFC-3339 formatted timestamp in UTC. */
289-
gt: Shared.DateTime,
290-
},
198+
gt?: Shared.DateTime,
291199

292-
@summary("Greater Than or Equal To")
293-
DateTimeFieldGTEFilter: {
294200
/** Value is greater than or equal to the given RFC-3339 formatted timestamp in UTC. */
295-
gte: Shared.DateTime,
201+
gte?: Shared.DateTime,
296202
},
297203
}
298204

0 commit comments

Comments
 (0)