Skip to content

Commit fa31d00

Browse files
authored
feat(spec): bootstrap AIP schema (#3619)
1 parent d73b821 commit fa31d00

35 files changed

+2538
-55
lines changed
Lines changed: 300 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,300 @@
1+
components:
2+
schemas:
3+
BooleanFieldFilter:
4+
title: BooleanFieldFilter
5+
description: Filter by a boolean value (true/false).
6+
type: boolean
7+
x-examples:
8+
example-1: true
9+
NumericFieldFilter:
10+
description: Filter by a numeric value.
11+
oneOf:
12+
- type: number
13+
description: Value strictly equals the given numeric value.
14+
example: 21
15+
- type: object
16+
title: NumericFieldEqualsFilter
17+
additionalProperties: false
18+
properties:
19+
eq:
20+
type: number
21+
description: Value strictly equals the given numeric value.
22+
example: 3.14
23+
required: [eq]
24+
- type: object
25+
title: NumericFieldLTFilter
26+
additionalProperties: false
27+
properties:
28+
lt:
29+
type: number
30+
description: Value is less than the given numeric value.
31+
example: 10
32+
required: [lt]
33+
- type: object
34+
title: NumericFieldLTEFilter
35+
additionalProperties: false
36+
properties:
37+
lte:
38+
type: number
39+
description: Value is less than or equal to the given numeric value.
40+
example: 10
41+
required: [lte]
42+
- type: object
43+
title: NumericFieldGTFilter
44+
additionalProperties: false
45+
properties:
46+
gt:
47+
type: number
48+
description: Value is greater than the given numeric value.
49+
example: 1.85
50+
required: [gt]
51+
- type: object
52+
title: NumericFieldGTEFilter
53+
additionalProperties: false
54+
properties:
55+
gte:
56+
type: number
57+
description: Value is greater than or equal to the given numeric value.
58+
example: 1.85
59+
required: [gte]
60+
x-examples:
61+
numeric_field_1: 11
62+
numeric_field_2:
63+
eq: 11
64+
numeric_field_3:
65+
lt: 15.85
66+
numeric_field_4:
67+
lte: 15.85
68+
numeric_field_5:
69+
gt: 3.14
70+
numeric_field_6:
71+
gte: 3.14
72+
SortQuery:
73+
title: SortQuery
74+
type: string
75+
example: 'created_at desc'
76+
description: |
77+
The `asc` suffix is optional as the default sort order is ascending.
78+
The `desc` suffix is used to specify a descending order.
79+
Multiple sort attributes may be provided via a comma separated list.
80+
JSONPath notation may be used to specify a sub-attribute (eg: 'foo.bar desc').
81+
UuidFieldFilter:
82+
title: UuidFieldFilter
83+
description: Filters on the given UUID field value by exact match.
84+
oneOf:
85+
- $ref: '#/components/schemas/StringFieldEqualsFilter'
86+
- $ref: '#/components/schemas/StringFieldOEQFilter'
87+
- $ref: '#/components/schemas/StringFieldNEQFilter'
88+
x-examples:
89+
example-1: '3bbfd3a-e9ab-48a9-9881-ed589e4615d1'
90+
example-2:
91+
eq: '3bbfd3a-e9ab-48a9-9881-ed589e4615d1'
92+
example-3:
93+
oeq: '3bbfd3a-e9ab-48a9-9881-ed589e4615d1'
94+
example-4:
95+
neq: '3bbfd3a-e9ab-48a9-9881-ed589e4615d1'
96+
StringFieldFilter:
97+
title: StringFieldFilter
98+
description: Filters on the given string field value by either exact or fuzzy match.
99+
oneOf:
100+
- $ref: '#/components/schemas/StringFieldEqualsFilter'
101+
- $ref: '#/components/schemas/StringFieldContainsFilter'
102+
- $ref: '#/components/schemas/StringFieldOContainsFilter'
103+
- $ref: '#/components/schemas/StringFieldOEQFilter'
104+
- $ref: '#/components/schemas/StringFieldNEQFilter'
105+
x-examples:
106+
example-1: 'equals-some-value'
107+
example-2:
108+
eq: 'some-value'
109+
example-3:
110+
contains: 'some-value'
111+
example-4:
112+
ocontains: 'some-potential,value'
113+
example-5:
114+
oeq: 'some-potential,value'
115+
example-6:
116+
neq: 'not-this-value'
117+
StringFieldFilterExact:
118+
title: StringFieldFilterExact
119+
description: Filters on the given string field value by exact match.
120+
oneOf:
121+
- $ref: '#/components/schemas/StringFieldEqualsFilter'
122+
- $ref: '#/components/schemas/StringFieldOEQFilter'
123+
- $ref: '#/components/schemas/StringFieldNEQFilter'
124+
x-examples:
125+
example-1: 'equals-some-value'
126+
example-2:
127+
eq: 'some-value'
128+
example-3:
129+
oeq: 'some-potential,value'
130+
example-4:
131+
neq: 'not-this-value'
132+
StringFieldEqualsFilter:
133+
title: StringFieldEqualsFilter
134+
description: Filters on the given string field value by exact match.
135+
oneOf:
136+
- type: string
137+
- type: object
138+
title: StringFieldEqualsComparison
139+
additionalProperties: false
140+
properties:
141+
eq:
142+
type: string
143+
required: [eq]
144+
x-examples:
145+
example-1: 'equals-some-value'
146+
example-2:
147+
eq: 'some-value'
148+
StringFieldContainsFilter:
149+
title: StringFieldContainsFilter
150+
description: Filters on the given string field value by fuzzy match.
151+
type: object
152+
additionalProperties: false
153+
properties:
154+
contains:
155+
type: string
156+
required: [contains]
157+
x-examples:
158+
example-1:
159+
contains: 'some-value'
160+
StringFieldOContainsFilter:
161+
title: StringFieldOContainsFilter
162+
description: Returns entities that fuzzy-match any of the comma-delimited phrases in the filter string.
163+
type: object
164+
additionalProperties: false
165+
properties:
166+
ocontains:
167+
type: string
168+
required: [ocontains]
169+
x-examples:
170+
example-1:
171+
ocontains: 'this-value,or-that-value'
172+
StringFieldOEQFilter:
173+
title: StringFieldOEQFilter
174+
description: Returns entities that exact match any of the comma-delimited phrases in the filter string.
175+
type: object
176+
additionalProperties: false
177+
properties:
178+
oeq:
179+
type: string
180+
required: [oeq]
181+
x-examples:
182+
example-1:
183+
oeq: 'some-value,some-other-value'
184+
StringFieldNEQFilter:
185+
title: StringFieldNEQFilter
186+
description: Filters on the given string field value by exact match inequality.
187+
type: object
188+
additionalProperties: false
189+
properties:
190+
neq:
191+
type: string
192+
required: [neq]
193+
x-examples:
194+
example-1:
195+
neq: 'not-this-value'
196+
DateTimeFieldFilter:
197+
title: DateTimeFieldFilter
198+
description: Filters on the given datetime (RFC-3339) field value.
199+
oneOf:
200+
- type: string
201+
title: DateTimeFieldImplicitEqualsFilter
202+
format: date-time
203+
description: Value strictly equals given RFC-3339 formatted timestamp in UTC
204+
example: 2022-03-30T07:20:50Z
205+
- type: object
206+
title: DateTimeFieldEqualsFilter
207+
additionalProperties: false
208+
properties:
209+
eq:
210+
type: string
211+
format: date-time
212+
description: Value strictly equals given RFC-3339 formatted timestamp in UTC
213+
example: 2022-03-30T07:20:50Z
214+
required: [eq]
215+
- type: object
216+
title: DateTimeFieldLTFilter
217+
additionalProperties: false
218+
properties:
219+
lt:
220+
type: string
221+
format: date-time
222+
description: Value is less than the given RFC-3339 formatted timestamp in UTC
223+
example: 2022-03-30T07:20:50Z
224+
required: [lt]
225+
- type: object
226+
title: DateTimeFieldLTEFilter
227+
additionalProperties: false
228+
properties:
229+
lte:
230+
type: string
231+
format: date-time
232+
description: Value is less than or equal to the given RFC-3339 formatted timestamp in UTC
233+
example: 2022-03-30T07:20:50Z
234+
required: [lte]
235+
- type: object
236+
title: DateTimeFieldGTFilter
237+
additionalProperties: false
238+
properties:
239+
lt:
240+
type: string
241+
format: date-time
242+
description: Value is greater than the given RFC-3339 formatted timestamp in UTC
243+
example: 2022-03-30T07:20:50Z
244+
required: [gt]
245+
- type: object
246+
title: DateTimeFieldGTEFilter
247+
additionalProperties: false
248+
properties:
249+
lte:
250+
type: string
251+
format: date-time
252+
description: Value is greater than or equal to the given RFC-3339 formatted timestamp in UTC
253+
example: 2022-03-30T07:20:50Z
254+
required: [gte]
255+
x-examples:
256+
datetime_field_1: '2022-03-30T07:20:50Z'
257+
datetime_field_2:
258+
eq: '2022-03-30T07:20:50Z'
259+
datetime_field_3:
260+
lt: '2022-03-30T07:20:50Z'
261+
datetime_field_4:
262+
lte: '2022-03-30T07:20:50Z'
263+
datetime_field_5:
264+
gt: '2022-03-30T07:20:50Z'
265+
datetime_field_6:
266+
gte: '2022-03-30T07:20:50Z'
267+
LabelsFieldFilter:
268+
allOf:
269+
- title: LabelsFieldFilter
270+
description: |
271+
Filters on the resource's `labels` field. Filters must use dot-notation to identify
272+
the label key that will be used to filter the results. For example:
273+
- `filter[labels.owner]`
274+
- `filter[labels.owner][neq]=kong`
275+
- `filter[labels.env]=dev`
276+
- `filter[labels.env][ocontains]=dev,test`
277+
- $ref: '#/components/schemas/StringFieldFilter'
278+
PublicLabelsFieldFilter:
279+
x-flatten-allOf: true
280+
allOf:
281+
- title: PublicLabelsFieldFilter
282+
description: |
283+
Filters on the resource's `public_labels` field. Filters must use dot-notation to identify
284+
the label key that will be used to filter the results. For example:
285+
- `filter[public_labels.collection]`
286+
- `filter[public_labels.collection][neq]=accounts`
287+
- `filter[public_labels.collection]=accounts`
288+
- `filter[public_labels.collection][ocontains]=accounts,invoices`
289+
- $ref: '#/components/schemas/StringFieldFilter'
290+
AttributesFieldFilter:
291+
allOf:
292+
- title: AttributesFieldFilter
293+
description: |
294+
Filters on the resource's `attributes` field. Filters must use dot-notation to identify
295+
the attribute key that will be used to filter the results. For example:
296+
- `filter[attributes.owner]`
297+
- `filter[attributes.owner][neq]=kong`
298+
- `filter[attributes.env]=dev`
299+
- `filter[attributes.env][ocontains]=dev,test`
300+
- $ref: '#/components/schemas/StringFieldFilter'

0 commit comments

Comments
 (0)