Skip to content

Commit 12840cd

Browse files
committed
Update schema
1 parent cf70002 commit 12840cd

File tree

1 file changed

+11
-241
lines changed
  • gbfs-validator-java-api/src/main/resources/public

1 file changed

+11
-241
lines changed

gbfs-validator-java-api/src/main/resources/public/openapi.yaml

Lines changed: 11 additions & 241 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ info:
33
title: GBFS Validator API
44
version: "0.1"
55
paths:
6-
/validate_option1:
6+
/validate:
77
post:
88
summary: Validate GBFS feed
99
requestBody:
@@ -14,33 +14,7 @@ paths:
1414
content:
1515
application/json:
1616
schema:
17-
$ref: "#/components/schemas/ValidationResultOption1"
18-
19-
/validate_option2:
20-
post:
21-
summary: Validate GBFS feed
22-
requestBody:
23-
$ref: '#/components/requestBodies/ValidateRequestBody'
24-
responses:
25-
'200':
26-
description: Validation result
27-
content:
28-
application/json:
29-
schema:
30-
$ref: "#/components/schemas/ValidationResultOption2"
31-
32-
/validate_option3:
33-
post:
34-
summary: Validate GBFS feed
35-
requestBody:
36-
$ref: '#/components/requestBodies/ValidateRequestBody'
37-
responses:
38-
'200':
39-
description: Validation result
40-
content:
41-
application/json:
42-
schema:
43-
$ref: "#/components/schemas/ValidationResultOption3"
17+
$ref: "#/components/schemas/ValidationResult"
4418

4519
components:
4620
requestBodies:
@@ -152,237 +126,35 @@ components:
152126
# The structure of the schema depends on the GBFS spec version.
153127
# We can reference all the version from the original json-schema on each file
154128
# Q: Do we need a version per file?
129+
# A from Tom: I would say no, but I've seen cases where producers mix versions, so on the fence
155130
version:
156131
type: string
157132
example: "3.0"
158-
# Q: are required and recommended needed? These fields are per spec version.
159-
required:
160-
type: boolean
161-
example: true
162-
recommended:
163-
type: boolean
164-
example: true
165-
exists:
166-
type: boolean
167-
example: true
168-
errors:
169-
type: array
170-
items:
171-
$ref: "#/components/schemas/FileError"
172-
schema:
173-
type: object
174-
175-
# Option 1
176-
177-
FileOption1:
178-
type: object
179-
properties:
180-
url:
181-
type: string
182-
format: uri
183-
example: "https://www.example.com/gbfs/v2/gbfs_versions"
184-
lang:
185-
type: string
186-
example: "en"
187-
exists:
188-
type: boolean
189-
example: true
190-
fileContent:
191-
type: object
192-
errors:
193-
type: array
194-
items:
195-
$ref: "#/components/schemas/FileError"
196-
197-
FileLangOption1:
198-
properties:
199-
name:
200-
type: string
201-
example: "gbfs_versions"
202-
version:
203-
type: string
204-
example: "2.3"
205-
required:
206-
type: boolean
207-
example: true
208-
recommended:
209-
type: boolean
210-
example: true
211-
exists:
212-
type: boolean
213-
example: true
214-
schema:
215-
type: object
216-
files:
217-
type: array
218-
items:
219-
$ref: "#/components/schemas/FileOption1"
220-
221-
ValidationResultOption1:
222-
type: object
223-
properties:
224-
summary:
225-
type: object
226-
properties:
227-
validatorVersion:
228-
type: string
229-
example: "v1.2"
230-
# Current we have versionDetected and versionValidated, are these fields needed or a single one?
231-
gbfsVersion:
232-
type: string
233-
example: "3.0"
234-
files:
235-
type: array
236-
items:
237-
oneOf:
238-
- $ref: "#/components/schemas/GbfsFile"
239-
- $ref: "#/components/schemas/FileLangOption1"
240-
241-
242-
# Option 2
243-
FileLangOption2:
244-
type: object
245-
properties:
246-
name:
247-
type: string
248-
example: "system_information"
249-
url:
250-
type: string
251-
format: uri
252-
example: "https://www.example.com/gbfs/v3/gbfs.json"
253-
version:
254-
type: string
255-
example: "3.0"
256-
required:
257-
type: boolean
258-
example: true
259-
recommended:
260-
type: boolean
261-
example: true
262-
exists:
263-
type: boolean
264-
example: true
265-
schema: #TODO: Do we need this?
266-
type: object
267-
fileContent:
268-
type: object
269-
lang:
133+
language:
270134
type: string
135+
required: false
271136
example: "en"
272-
errors:
273-
type: array
274-
items:
275-
$ref: "#/components/schemas/FileError"
276-
277-
FileOption2:
278-
type: object
279-
properties:
280-
name:
281-
type: string
282-
example: "gbfs_versions"
283-
url:
284-
type: string
285-
format: uri
286-
example: "https://www.example.com/gbfs/v2/gbfs_versions"
287-
version:
288-
type: string
289-
example: "3.0"
137+
description: "Only relevant for pre-v3 files"
138+
# Q: are required and recommended needed? These fields are per spec version.
139+
# A from Tom: Let's discuss this further on a call
290140
required:
291141
type: boolean
292142
example: true
293143
recommended:
294144
type: boolean
295145
example: true
146+
# Q from Tom: is exists needed?
296147
exists:
297148
type: boolean
298149
example: true
299-
schema: #TODO: Should we add a single schema or multiple per file?
300-
type: object
301-
languageFiles:
302-
type: array
303-
items:
304-
$ref: "#/components/schemas/FileLangOption2"
305-
306-
ValidationResultOption2:
307-
type: object
308-
properties:
309-
summary:
310-
type: object
311-
properties:
312-
validatorVersion:
313-
type: string
314-
example: "v1.2"
315-
# Current we have versionDetected and versionValidated, are these fields needed or a single one?
316-
gbfsVersion:
317-
type: string
318-
example: "3.0"
319-
files:
320-
type: array
321-
items:
322-
oneOf:
323-
- $ref: "#/components/schemas/GbfsFile"
324-
- $ref: "#/components/schemas/FileOption2"
325-
326-
# Option 3
327-
328-
FileOption3:
329-
type: object
330-
properties:
331-
url:
332-
type: string
333-
format: uri
334-
example: "https://www.example.com/gbfs/v2/gbfs_versions"
335-
lang:
336-
type: string
337-
example: "en"
338-
exists:
339-
type: boolean
340-
example: true
341-
fileContent:
342-
type: object
343150
errors:
344151
type: array
345152
items:
346153
$ref: "#/components/schemas/FileError"
347-
348-
FileLangOption3:
349-
properties:
350-
name:
351-
type: string
352-
example: "gbfs_versions"
353-
version:
354-
type: string
355-
example: "2.3"
356-
required:
357-
type: boolean
358-
example: true
359-
recommended:
360-
type: boolean
361-
example: true
362-
exists:
363-
type: boolean
364-
example: true
365154
schema:
366155
type: object
367-
files:
368-
type: object
369-
additionalProperties:
370-
$ref: "#/components/schemas/FileOption3"
371-
example:
372-
en:
373-
url: "https://www.example.com/gbfs/v2/gbfs_versions"
374-
lang: "en"
375-
exists: true
376-
fileContent: {}
377-
errors:
378-
- keyword: "string"
379-
instancePath: "string"
380-
schemaPath: "string"
381-
message: "string"
382-
params:
383-
additionalProp1: {}
384156

385-
ValidationResultOption3:
157+
ValidationResult:
386158
type: object
387159
properties:
388160
summary:
@@ -398,6 +170,4 @@ components:
398170
files:
399171
type: array
400172
items:
401-
oneOf:
402-
- $ref: "#/components/schemas/GbfsFile"
403-
- $ref: "#/components/schemas/FileLangOption3"
173+
$ref: "#/components/schemas/GbfsFile"

0 commit comments

Comments
 (0)