Skip to content

Commit

Permalink
openapi: Fixes for SwaggerUI reporting bundled API definition invalid
Browse files Browse the repository at this point in the history
- Error was: "attribute components.schemas.tileSet.items is missing"
- swagger-cli was declaring both the source and bundled definition as valid.
- discovered the source of the issue with the IBM openapi-validator
  (https://github.com/IBM/openapi-validator) which uses Spectral and reported
  the error as somewhat less cryptic, pointing to missing "item" for array type
  in propertiesSchema.yaml
- .validaterc configuration file avoiding the many warnings by default added
  • Loading branch information
jerstlouis committed Dec 24, 2021
1 parent ae6eefb commit 170c1aa
Show file tree
Hide file tree
Showing 3 changed files with 138 additions and 1 deletion.
100 changes: 100 additions & 0 deletions openapi/.validaterc
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{
"shared": {
"operations": {
"no_operation_id": "warning",
"operation_id_case_convention": [
"off"
],
"no_summary": "warning",
"no_array_responses": "error",
"parameter_order": "warning",
"undefined_tag": "warning",
"unused_tag": "warning",
"operation_id_naming_convention": "off"
},
"pagination": {
"pagination_style": "warning"
},
"parameters": {
"no_parameter_description": "error",
"param_name_case_convention": [
"off"
],
"invalid_type_format_pair": "off",
"content_type_parameter": "error",
"accept_type_parameter": "error",
"authorization_parameter": "warning",
"required_param_has_default": "warning"
},
"paths": {
"missing_path_parameter": "error",
"duplicate_path_parameter": "warning",
"snake_case_only": "off",
"paths_case_convention": [
"off"
]
},
"responses": {
"inline_response_schema": "warning"
},
"security_definitions": {
"unused_security_schemes": "warning",
"unused_security_scopes": "warning"
},
"security": {
"invalid_non_empty_security_array": "error"
},
"schemas": {
"invalid_type_format_pair": "off",
"snake_case_only": "off",
"no_schema_description": "warning",
"no_property_description": "warning",
"description_mentions_json": "warning",
"array_of_arrays": "warning",
"inconsistent_property_type": [
"warning",
[
"code",
"default",
"type",
"value"
]
],
"property_case_convention": [
"off"
],
"property_case_collision": "error",
"enum_case_convention": [
"off"
]
},
"walker": {
"no_empty_descriptions": "off",
"has_circular_references": "warning",
"$ref_siblings": "off",
"duplicate_sibling_description": "warning",
"incorrect_ref_pattern": "warning"
}
},
"swagger2": {
"operations": {
"no_consumes_for_put_or_post": "error",
"get_op_has_consumes": "warning",
"no_produces": "warning"
}
},
"oas3": {
"operations": {
"no_request_body_name": "warning"
},
"responses": {
"no_success_response_codes": "warning",
"protocol_switching_and_success_code": "error",
"no_response_body": "warning",
"ibm_status_code_guidelines": "warning"
},
"schemas": {
"json_or_param_binary_string": "warning"
}
}
}
28 changes: 27 additions & 1 deletion openapi/ogcapi-tiles-1.bundled.json
Original file line number Diff line number Diff line change
Expand Up @@ -2285,7 +2285,10 @@
"required": {
"description": "Implements 'multiplicity' by citing property 'name' defined as 'additionalProperties'",
"type": "array",
"minItems": 1
"minItems": 1,
"items": {
"type": "string"
}
},
"properties": {
"type": "object",
Expand Down Expand Up @@ -2317,6 +2320,29 @@
"description": "Implements 'acceptedValues'",
"type": "array",
"minItems": 1,
"items": {
"oneOf": [
{
"type": "array"
},
{
"type": "boolean"
},
{
"type": "integer"
},
{
"type": "number"
},
{
"type": "object",
"nullable": true
},
{
"type": "string"
}
]
},
"uniqueItems": true
},
"format": {
Expand Down
11 changes: 11 additions & 0 deletions openapi/schemas/tms/propertiesSchema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ properties:
'additionalProperties'
type: array
minItems: 1
items:
type: string
properties:
type: object
default: {}
Expand Down Expand Up @@ -42,6 +44,15 @@ properties:
description: Implements 'acceptedValues'
type: array
minItems: 1
items:
oneOf:
- type: array
- type: boolean
- type: integer
- type: number
- type: object
nullable: true
- type: string
uniqueItems: true
format:
description: Complements implementation of 'type'
Expand Down

0 comments on commit 170c1aa

Please sign in to comment.