Skip to content

Commit 3f3dc50

Browse files
committed
feat(api): update aip ffeld filter types
1 parent 5bd91ea commit 3f3dc50

9 files changed

Lines changed: 1573 additions & 326 deletions

File tree

api/spec/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ generate: format ## Generate OpenAPI spec
1616
pnpm --filter @openmeter/api-spec-aip exec openapi bundle output/definitions/metering-and-billing/v3/openapi.OpenMeter.yaml -o ../../../v3/openapi.yaml
1717
cp packages/legacy/output/openapi.OpenMeter.yaml ../openapi.yaml
1818
cp packages/legacy/output/openapi.OpenMeterCloud.yaml ../openapi.cloud.yaml
19+
cp packages/aip/output/definitions/metering-and-billing/v3/openapi.Test.yaml ../v3/test/openapi.test.yaml
1920

2021
.PHONY: lint
2122
lint: ## Lint OpenAPI spec

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

Lines changed: 182 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,16 @@ model SortQuery {}
2525
"x-go-type-import",
2626
#{ path: "github.com/openmeterio/openmeter/api/v3/filters" }
2727
)
28+
@oneOf
29+
@summary("Boolean Field Filter")
2830
union BooleanFieldFilter {
29-
boolean: boolean,
30-
object: {
31+
@summary("Equals (short form)")
32+
equals: boolean,
33+
34+
@summary("Equals")
35+
BooleanFieldEQFilter: {
3136
/** Value strictly equals the given boolean value. */
32-
eq?: boolean,
37+
eq: boolean,
3338
},
3439
}
3540

@@ -43,28 +48,54 @@ union BooleanFieldFilter {
4348
"x-go-type-import",
4449
#{ path: "github.com/openmeterio/openmeter/api/v3/filters" }
4550
)
46-
model NumericFieldFilter {
47-
/** Value strictly equals the given numeric value. */
48-
eq?: float64;
51+
@oneOf
52+
@summary("Numeric Field Filter")
53+
union NumericFieldFilter {
54+
@summary("Equals (short form)")
55+
equals: float64,
56+
57+
@summary("Equals")
58+
NumericFieldEQFilter: {
59+
/** Value strictly equals the given numeric value. */
60+
eq: float64,
61+
},
4962

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

53-
/** Returns entities that match any of the comma-delimited numeric values. */
54-
@encode(ArrayEncoding.commaDelimited)
55-
oeq?: float64[];
69+
@summary("Equals one of")
70+
NumericFieldOEQFilter: {
71+
/** Returns entities that match any of the comma-delimited numeric values. */
72+
@encode(ArrayEncoding.commaDelimited)
73+
oeq: float64[],
74+
},
5675

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

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

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

66-
/** Value is greater than or equal to the given numeric value. */
67-
gte?: float64;
94+
@summary("Greater Than or Equal To")
95+
NumericFieldGTEFilter: {
96+
/** Value is greater than or equal to the given numeric value. */
97+
gte: float64,
98+
},
6899
}
69100

70101
/**
@@ -77,40 +108,72 @@ model NumericFieldFilter {
77108
"x-go-type-import",
78109
#{ path: "github.com/openmeterio/openmeter/api/v3/filters" }
79110
)
111+
@oneOf
112+
@summary("String Field Filter")
80113
union StringFieldFilter {
81-
string: string,
82-
object: {
114+
@summary("Equals (short form)")
115+
equals: string,
116+
117+
@summary("Equals")
118+
StringFieldEQFilter: {
83119
/** Value strictly equals the given string value. */
84-
eq?: string,
120+
eq: string,
121+
},
85122

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

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

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

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

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

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

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

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

173+
@summary("Exists")
174+
StringFieldExistsFilter: {
112175
/** When true, the field must be present (non-null); when false, the field must be absent (null). */
113-
exists?: boolean,
176+
exists: boolean,
114177
},
115178
}
116179

@@ -124,16 +187,30 @@ union StringFieldFilter {
124187
"x-go-type-import",
125188
#{ path: "github.com/openmeterio/openmeter/api/v3/filters" }
126189
)
127-
model StringFieldFilterExact {
128-
/** Value strictly equals the given string value. */
129-
eq?: string;
190+
@oneOf
191+
@summary("String Field Filter Exact")
192+
union StringFieldFilterExact {
193+
@summary("Equals (short form)")
194+
equals: string,
195+
196+
@summary("Equals")
197+
StringFieldEQFilter: {
198+
/** Value strictly equals the given string value. */
199+
eq: string,
200+
},
130201

131-
/** Returns entities that exact match any of the comma-delimited phrases in the filter string. */
132-
@encode(ArrayEncoding.commaDelimited)
133-
oeq?: string[];
202+
@summary("Equals one of")
203+
StringFieldOEQFilter: {
204+
/** Returns entities that exact match any of the comma-delimited phrases in the filter string. */
205+
@encode(ArrayEncoding.commaDelimited)
206+
oeq: string[],
207+
},
134208

135-
/** Value does not equal the given string value. */
136-
neq?: string;
209+
@summary("Not Equals")
210+
StringFieldNEQFilter: {
211+
/** Value does not equal the given string value. */
212+
neq: string,
213+
},
137214
}
138215

139216
/**
@@ -146,18 +223,29 @@ model StringFieldFilterExact {
146223
"x-go-type-import",
147224
#{ path: "github.com/openmeterio/openmeter/api/v3/filters" }
148225
)
226+
@oneOf
227+
@summary("ULID Field Filter")
149228
union ULIDFieldFilter {
150-
string: Shared.ULID,
151-
object: {
152-
/** Value strictly equals the given ULID value. */
153-
eq?: Shared.ULID,
229+
@summary("Equals (short form)")
230+
equals: Shared.ULID,
154231

155-
/** Value does not equal the given ULID value. */
156-
neq?: Shared.ULID,
232+
@summary("Equals")
233+
ULIDFieldEQFilter: {
234+
/** Value strictly equals the given ULID value. */
235+
eq: Shared.ULID,
236+
},
157237

238+
@summary("Equals one of")
239+
ULIDFieldOEQFilter: {
158240
/** Returns entities that exact match any of the comma-delimited ULIDs in the filter string. */
159241
@encode(ArrayEncoding.commaDelimited)
160-
oeq?: Shared.ULID[],
242+
oeq: Shared.ULID[],
243+
},
244+
245+
@summary("Not Equals")
246+
ULIDFieldNEQFilter: {
247+
/** Value does not equal the given ULID value. */
248+
neq: Shared.ULID,
161249
},
162250
}
163251

@@ -171,23 +259,40 @@ union ULIDFieldFilter {
171259
"x-go-type-import",
172260
#{ path: "github.com/openmeterio/openmeter/api/v3/filters" }
173261
)
262+
@oneOf
263+
@summary("DateTime Field Filter")
174264
union DateTimeFieldFilter {
175-
string: string,
176-
object: {
265+
@summary("Equals (short form)")
266+
equals: Shared.DateTime,
267+
268+
@summary("Equals")
269+
DateTimeFieldEQFilter: {
177270
/** Value strictly equals given RFC-3339 formatted timestamp in UTC. */
178-
eq?: Shared.DateTime,
271+
eq: Shared.DateTime,
272+
},
179273

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

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

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

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

@@ -200,24 +305,41 @@ union DateTimeFieldFilter {
200305
"x-go-type-import",
201306
#{ path: "github.com/openmeterio/openmeter/api/v3/filters" }
202307
)
308+
@oneOf
309+
@summary("Labels Field Filter")
203310
union LabelsFieldFilter {
204-
string: string,
205-
object: {
311+
@summary("Equals (short form)")
312+
equals: string,
313+
314+
@summary("Equals")
315+
LabelsFieldEqualsFilter: {
206316
/** Value strictly equals the given string value. */
207-
eq?: string,
317+
eq: string,
318+
},
208319

320+
@summary("Contains")
321+
LabelsFieldContainsFilter: {
209322
/** Value contains the given string value (fuzzy match). */
210-
contains?: string,
323+
contains: string,
324+
},
211325

326+
@summary("Contains one of")
327+
LabelsFieldOContainsFilter: {
212328
/** Returns entities that fuzzy-match any of the comma-delimited phrases in the filter string. */
213329
@encode(ArrayEncoding.commaDelimited)
214-
ocontains?: string[],
330+
ocontains: string[],
331+
},
215332

333+
@summary("Equals one of")
334+
LabelsFieldOEQFilter: {
216335
/** Returns entities that exact match any of the comma-delimited phrases in the filter string. */
217336
@encode(ArrayEncoding.commaDelimited)
218-
oeq?: string[],
337+
oeq: string[],
338+
},
219339

340+
@summary("Not Equals")
341+
LabelsFieldNEQFilter: {
220342
/** Value does not equal the given string value. */
221-
neq?: string,
343+
neq: string,
222344
},
223345
}

api/spec/packages/aip/src/main.tsp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
import "./openmeter.tsp";
22
import "./konnect.tsp";
3+
import "./test.tsp";

0 commit comments

Comments
 (0)