Skip to content

Commit

Permalink
fix: open api spec
Browse files Browse the repository at this point in the history
  • Loading branch information
cka-y committed Aug 14, 2024
1 parent 49f2c19 commit 4052281
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 6 deletions.
72 changes: 67 additions & 5 deletions docs/gbfs-validator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ info:
email: [email protected]
license:
name: MobilityData License
url: https://www.apache.org/licenses/LICENSE-2.0
url: https://www.apache.org/licenses/LICENSE-2.0
servers:
- url: https://gbfs-validator.netlify.app/.netlify/functions
description: Production release environment
description: Production release environment
- url: http://localhost:8888/.netlify/functions
description: Local development environment
description: Local development environment
paths:
/validator:
post:
Expand Down Expand Up @@ -41,7 +41,7 @@ paths:
/feed:
post:
summary: Get feed content
description: Get content of all GBFS's files. Usefull to avoid CORS errors.
description: Get content of all GBFS's files. Useful to avoid CORS errors.
requestBody:
content:
application/json:
Expand All @@ -61,6 +61,29 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error'
/validator-summary:
post:
summary: Get a summary of the validation results
description: Returns a summary from the validator's response, including grouped error details.
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ValidatorRequest'
required: true
responses:
'200':
description: Validation summary
content:
application/json:
schema:
$ref: '#/components/schemas/ValidationSummary'
'500':
description: Error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
components:
schemas:
Error:
Expand Down Expand Up @@ -162,7 +185,7 @@ components:
tokenUrl:
type: string
required:
- url
- url
FeedRequest:
required:
- url
Expand All @@ -183,3 +206,42 @@ components:
type: array
items:
type: object
ValidationSummary:
type: object
properties:
summary:
type: object
filesSummary:
type: array
items:
type: object
properties:
required:
type: boolean
exists:
type: boolean
file:
type: string
hasErrors:
type: boolean
errorsCount:
type: number
groupedErrors:
type: array
items:
type: object
properties:
keyword:
type: string
message:
type: string
schemaPath:
type: string
count:
type: number
required:
- required
- exists
- file
- hasErrors
- errorsCount
Empty file removed functions/openapi.js
Empty file.
4 changes: 3 additions & 1 deletion functions/validator-summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ const getSummary = (validationResult) => (
file: item.file,
hasErrors: item.hasErrors,
errorsCount: item.errorsCount,
groupedErrors: item.exists ? groupErrors(item.languages[0]?.errors || []) : []
groupedErrors: item.exists && item.languages && item.languages[0] && item.languages[0].errors
? groupErrors(item.languages[0].errors)
: []
}))
}
)
Expand Down

0 comments on commit 4052281

Please sign in to comment.