@@ -8,45 +8,153 @@ namespace Common;
88
99/**
1010 * Sort query.
11+ *
12+ * The `asc` suffix is optional as the default sort order is ascending.
13+ * The `desc` suffix is used to specify a descending order.
14+ * Multiple sort attributes may be provided via a comma separated list.
15+ * JSONPath notation may be used to specify a sub-attribute (eg: 'foo.bar desc').
1116 */
12- @ useRef ("../../../../common/definitions/aip_filters.yaml#/components/schemas/SortQuery" )
17+ // @useRef("../../../../common/definitions/aip_filters.yaml#/components/schemas/SortQuery")
1318@ friendlyName ("SortQuery" )
14- model SortQuery {}
19+ scalar SortQuery extends string ;
1520
1621/**
1722 * Filter by a boolean value (true/false).
1823 */
24+ // @useRef("../../../../common/definitions/aip_filters.yaml#/components/schemas/BooleanFieldFilter")
1925@ friendlyName ("BooleanFieldFilter" )
20- @ useRef ("../../../../common/definitions/aip_filters.yaml#/components/schemas/BooleanFieldFilter" )
21- model BooleanFieldFilter {}
26+ @ extension ("x-go-type" , "filters.FilterBoolean" )
27+ @ extension (
28+ "x-go-type-import" ,
29+ #{ path : "github.com/openmeterio/openmeter/api/v3/filters" }
30+ )
31+ scalar BooleanFieldFilter extends boolean ;
2232
2333/**
2434 * Filter by a numeric value.
35+ * All properties are optional; provide exactly one to specify the comparison.
2536 */
2637@ friendlyName ("NumericFieldFilter" )
27- @ useRef ("../../../../common/definitions/aip_filters.yaml#/components/schemas/NumericFieldFilter" )
28- model NumericFieldFilter {}
38+ // @useRef("../../../../common/definitions/aip_filters.yaml#/components/schemas/NumericFieldFilter")
39+ @ extension ("x-go-type" , "filters.FilterNumeric" )
40+ @ extension (
41+ "x-go-type-import" ,
42+ #{ path : "github.com/openmeterio/openmeter/api/v3/filters" }
43+ )
44+ model NumericFieldFilter {
45+ /** Value strictly equals the given numeric value. */
46+ eq ? : float64 ;
47+
48+ /** Value does not equal the given numeric value. */
49+ neq ? : float64 ;
50+
51+ /** Returns entities that match any of the comma-delimited numeric values. */
52+ @ encode (ArrayEncoding .commaDelimited )
53+ oeq ? : float64 [];
54+
55+ /** Value is less than the given numeric value. */
56+ lt ? : float64 ;
57+
58+ /** Value is less than or equal to the given numeric value. */
59+ lte ? : float64 ;
60+
61+ /** Value is greater than the given numeric value. */
62+ gt ? : float64 ;
63+
64+ /** Value is greater than or equal to the given numeric value. */
65+ gte ? : float64 ;
66+ }
2967
3068/**
3169 * Filters on the given string field value by either exact or fuzzy match.
70+ * All properties are optional; provide exactly one to specify the comparison.
3271 */
3372@ friendlyName ("StringFieldFilter" )
34- @ useRef ("../../../../common/definitions/aip_filters.yaml#/components/schemas/StringFieldFilter" )
35- model StringFieldFilter {}
73+ // @useRef("../../../../common/definitions/aip_filters.yaml#/components/schemas/StringFieldFilter")
74+ @ extension ("x-go-type" , "filters.FilterString" )
75+ @ extension (
76+ "x-go-type-import" ,
77+ #{ path : "github.com/openmeterio/openmeter/api/v3/filters" }
78+ )
79+ union StringFieldFilter {
80+ string : string ,
81+ object : {
82+ /** Value strictly equals the given string value. */
83+ eq ? : string ,
84+
85+ /** Value contains the given string value (fuzzy match). */
86+ contains ? : string ,
87+
88+ /** Returns entities that fuzzy-match any of the comma-delimited phrases in the filter string. */
89+ @ encode (ArrayEncoding .commaDelimited )
90+ ocontains ? : string [],
91+
92+ /** Returns entities that exact match any of the comma-delimited phrases in the filter string. */
93+ @ encode (ArrayEncoding .commaDelimited )
94+ oeq ? : string [],
95+
96+ /** Value does not equal the given string value. */
97+ neq ? : string ,
98+ },
99+ }
36100
37101/**
38102 * Filters on the given string field value by exact match.
103+ * All properties are optional; provide exactly one to specify the comparison.
39104 */
40105@ friendlyName ("StringFieldFilterExact" )
41- @ useRef ("../../../../common/definitions/aip_filters.yaml#/components/schemas/StringFieldFilterExact" )
42- model StringFieldFilterExact {}
106+ // @useRef("../../../../common/definitions/aip_filters.yaml#/components/schemas/StringFieldFilterExact")
107+ @ extension ("x-go-type" , "filters.FilterStringExact" )
108+ @ extension (
109+ "x-go-type-import" ,
110+ #{ path : "github.com/openmeterio/openmeter/api/v3/filters" }
111+ )
112+ model StringFieldFilterExact {
113+ /** Value strictly equals the given string value. */
114+ eq ? : string ;
115+
116+ /** Returns entities that exact match any of the comma-delimited phrases in the filter string. */
117+ @ encode (ArrayEncoding .commaDelimited )
118+ oeq ? : string [];
119+
120+ /** Value does not equal the given string value. */
121+ neq ? : string ;
122+ }
43123
44124/**
45125 * Filters on the given datetime (RFC-3339) field value.
126+ * All properties are optional; provide exactly one to specify the comparison.
46127 */
47128@ friendlyName ("DateTimeFieldFilter" )
48- @ useRef ("../../../../common/definitions/aip_filters.yaml#/components/schemas/DateTimeFieldFilter" )
49- model DateTimeFieldFilter {}
129+ // @useRef("../../../../common/definitions/aip_filters.yaml#/components/schemas/DateTimeFieldFilter")
130+ @ extension ("x-go-type" , "filters.FilterDateTime" )
131+ @ extension (
132+ "x-go-type-import" ,
133+ #{ path : "github.com/openmeterio/openmeter/api/v3/filters" }
134+ )
135+ model DateTimeFieldFilter {
136+ /** Value strictly equals given RFC-3339 formatted timestamp in UTC. */
137+ eq ? : Shared .DateTime ;
138+
139+ /** Value does not equal the given RFC-3339 formatted timestamp in UTC. */
140+ neq ? : Shared .DateTime ;
141+
142+ /** Returns entities that match any of the comma-delimited RFC-3339 formatted timestamps. */
143+ @ encode (ArrayEncoding .commaDelimited )
144+ oeq ? : Shared .DateTime [];
145+
146+ /** Value is less than the given RFC-3339 formatted timestamp in UTC. */
147+ lt ? : Shared .DateTime ;
148+
149+ /** Value is less than or equal to the given RFC-3339 formatted timestamp in UTC. */
150+ lte ? : Shared .DateTime ;
151+
152+ /** Value is greater than the given RFC-3339 formatted timestamp in UTC. */
153+ gt ? : Shared .DateTime ;
154+
155+ /** Value is greater than or equal to the given RFC-3339 formatted timestamp in UTC. */
156+ gte ? : Shared .DateTime ;
157+ }
50158
51159/**
52160 * Filters on the resource's `labels` field. Filters must use dot-notation to identify
@@ -57,29 +165,30 @@ model DateTimeFieldFilter {}
57165 * - `filter[labels.env][ocontains]=dev,test`
58166 */
59167@ friendlyName ("LabelsFieldFilter" )
60- @ useRef ("../../../../common/definitions/aip_filters.yaml#/components/schemas/LabelsFieldFilter" )
61- model LabelsFieldFilter {}
168+ // @useRef("../../../../common/definitions/aip_filters.yaml#/components/schemas/LabelsFieldFilter")
169+ @ extension ("x-go-type" , "filters.FilterString" )
170+ @ extension (
171+ "x-go-type-import" ,
172+ #{ path : "github.com/openmeterio/openmeter/api/v3/filters" }
173+ )
174+ union LabelsFieldFilter {
175+ string : string ,
176+ object : {
177+ /** Value strictly equals the given string value. */
178+ eq ? : string ,
62179
63- /**
64- * Filters on the resource's `public_labels` field. Filters must use dot-notation to identify
65- * the label key that will be used to filter the results. For example:
66- * - `filter[public_labels.owner]`
67- * - `filter[public_labels.owner][neq]=kong`
68- * - `filter[public_labels.env]=dev`
69- * - `filter[public_labels.env][ocontains]=dev,test`
70- */
71- @ friendlyName ("PublicLabelsFieldFilter" )
72- @ useRef ("../../../../common/definitions/aip_filters.yaml#/components/schemas/PublicLabelsFieldFilter" )
73- model PublicLabelsFieldFilter {}
180+ /** Value contains the given string value (fuzzy match). */
181+ contains ? : string ,
74182
75- /**
76- * Filters on the resource's `attributes` field. Filters must use dot-notation to identify
77- * the attribute key that will be used to filter the results. For example:
78- * - `filter[attributes.owner]`
79- * - `filter[attributes.owner][neq]=kong`
80- * - `filter[attributes.env]=dev`
81- * - `filter[attributes.env][ocontains]=dev,test`
82- */
83- @ friendlyName ("AttributesFieldFilter" )
84- @ useRef ("../../../../common/definitions/aip_filters.yaml#/components/schemas/AttributesFieldFilter" )
85- model AttributesFieldFilter {}
183+ /** Returns entities that fuzzy-match any of the comma-delimited phrases in the filter string. */
184+ @ encode (ArrayEncoding .commaDelimited )
185+ ocontains ? : string [],
186+
187+ /** Returns entities that exact match any of the comma-delimited phrases in the filter string. */
188+ @ encode (ArrayEncoding .commaDelimited )
189+ oeq ? : string [],
190+
191+ /** Value does not equal the given string value. */
192+ neq ? : string ,
193+ },
194+ }
0 commit comments