From 8b10451bdb316e8e3c874d90277b0fafa3b9d8ec Mon Sep 17 00:00:00 2001 From: Panagiotis Vretanos Date: Tue, 5 Nov 2024 11:38:43 -0500 Subject: [PATCH] Patch validation errors using @redocly/cli for validation. --- .../ogcapi-records-1-building-blocks.yaml | 63 ++++++++++++------- ...s-1-example-ref-buildingblocks-bundle.yaml | 51 ++++++++++++--- ...api-records-1-example-ref-schema-repo.yaml | 49 ++++++++++++--- core/openapi/parameters/language.yaml | 3 +- core/openapi/responses/BadRequest.yaml | 10 +++ core/openapi/responses/Sortables.yaml | 4 +- core/openapi/schemas/catalog.yaml | 2 +- core/openapi/schemas/contact.yaml | 4 +- core/openapi/schemas/language.yaml | 6 +- core/openapi/schemas/linkBase.yaml | 12 ++-- core/openapi/schemas/linkTemplate.yaml | 3 +- core/openapi/schemas/time.yaml | 2 +- 12 files changed, 153 insertions(+), 56 deletions(-) create mode 100644 core/openapi/responses/BadRequest.yaml diff --git a/core/openapi/ogcapi-records-1-building-blocks.yaml b/core/openapi/ogcapi-records-1-building-blocks.yaml index 440b869b..4e5a90ae 100644 --- a/core/openapi/ogcapi-records-1-building-blocks.yaml +++ b/core/openapi/ogcapi-records-1-building-blocks.yaml @@ -91,8 +91,8 @@ components: items: type: string pattern: "^((?:(en-GB-oed|i-ami|i-bnn|i-default|i-enochian|i-hak|i-klingon|i-lux|i-mingo|i-navajo|i-pwn|i-tao|i-tay|i-tsu|sgn-BE-FR|sgn-BE-NL|sgn-CH-DE)|(art-lojban|cel-gaulish|no-bok|no-nyn|zh-guoyu|zh-hakka|zh-min|zh-min-nan|zh-xiang))|((?:([A-Za-z]{2,3}(-(?:[A-Za-z]{3}(-[A-Za-z]{3}){0,2}))?)|[A-Za-z]{4}|[A-Za-z]{5,8})(-(?:[A-Za-z]{4}))?(-(?:[A-Za-z]{2}|[0-9]{3}))?(-(?:[A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3}))*(-(?:[0-9A-WY-Za-wy-z](-[A-Za-z0-9]{2,8})+))*(-(?:x(-[A-Za-z0-9]{1,8})+))?)|(?:x(-[A-Za-z0-9]{1,8})+))(?:;q=(?:1|1\\.0+|0|0\\.[0-9]+))?$" - examples: - - "de;q=0.7" + example: + - "de;q=0.7" explode: false style: form q: @@ -166,7 +166,7 @@ components: - record - catalog type: - descripton: + description: Fixed to catalog for collections of records and/or subordinate catalogs. type: string @@ -257,7 +257,7 @@ components: type: string description: The value is the phone number itself. pattern: "^\\+[1-9]{1}[0-9]{3,14}$" - examples: + example: - "+14165550142" roles: description: @@ -318,7 +318,7 @@ components: hoursOfService: type: string description: Time period when the contact can be contacted. - examples: + example: - "Hours: Mo-Fr 10am-7pm Sa 10am-22pm Su 10am-21pm" contactInstructions: type: string @@ -371,21 +371,21 @@ components: type: string description: The language tag as per RFC-5646. - examples: + example: - "el" name: type: string minLength: 1 description: The untranslated name of the language. - examples: + example: - "Ελληνικά" alternate: type: string description: The name of the language in another well-understood language, usually English. - examples: + example: - "Greek" dir: type: string @@ -426,26 +426,30 @@ components: rel: type: string description: The type or semantics of the relation. - example: "alternate" + example: + - "alternate" type: type: string description: A hint indicating what the media type of the result of dereferencing the link should be. - example: "application/geo+json" + example: + - "application/geo+json" hreflang: type: string description: A hint indicating what the language of the result of dereferencing the link should be. - example: "en" + example: + - "en" title: type: string description: Used to label the destination of a link such that it can be used as a human-readable identifier. - example: "Trierer Strasse 70, 53115 Bonn" + example: + - "Trierer Strasse 70, 53115 Bonn" length: type: integer created: @@ -472,7 +476,8 @@ components: description: Supplies a resolvable URI to a remote resource (or resource fragment). - example: "http://data.example.com/buildings/(building-id}" + example: + - "http://data.example.com/buildings/(building-id}" varBase: type: string description: @@ -749,7 +754,7 @@ components: description: Minimum time period resolvable in the dataset, as an ISO 8601 duration. - examples: + example: - "P1D" exception: type: object @@ -783,23 +788,23 @@ components: id: description: identifier of the collection used, for example, in URIs type: string - examples: - - address + example: + - "address" title: description: human readable title of the collection type: string - examples: - - address + example: + - "address" description: description: a description of the features in the collection type: string - examples: - - An address. + example: + - "An address." links: type: array items: $ref: '#/components/schemas/link' - examples: + example: - href: http://data.example.com/buildings rel: item - href: http://example.com/concepts/buildings.html @@ -818,7 +823,7 @@ components: type: string default: - http://www.opengis.net/def/crs/OGC/1.3/CRS84 - examples: + example: - http://www.opengis.net/def/crs/OGC/1.3/CRS84 - http://www.opengis.net/def/crs/EPSG/0/4326 extent: @@ -901,7 +906,7 @@ components: maxItems: 6 items: type: number - examples: + example: - - -180 - -90 - 180 @@ -955,7 +960,7 @@ components: type: string format: date-time nullable: true - examples: + example: - '2011-11-11T12:22:11Z' - null trs: @@ -1333,6 +1338,16 @@ components: text/html: schema: type: string + BadRequest: + description: + A server error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/exception' + text/html: + schema: + type: string ServerError: description: A server error occurred. diff --git a/core/openapi/ogcapi-records-1-example-ref-buildingblocks-bundle.yaml b/core/openapi/ogcapi-records-1-example-ref-buildingblocks-bundle.yaml index e489b161..48b928a0 100644 --- a/core/openapi/ogcapi-records-1-example-ref-buildingblocks-bundle.yaml +++ b/core/openapi/ogcapi-records-1-example-ref-buildingblocks-bundle.yaml @@ -62,7 +62,11 @@ paths: responses: '200': $ref: 'ogcapi-records-1-building-blocks.yaml#/components/responses/LandingPage' - '500': + '4XX': + $ref: 'ogcapi-records-1-building-blocks.yaml#/components/responses/BadRequest' + '406': + $ref: 'ogcapi-records-1-building-blocks.yaml#/components/responses/NotAcceptable' + '5XX': $ref: 'ogcapi-records-1-building-blocks.yaml#/components/responses/ServerError' '/conformance': get: @@ -76,7 +80,11 @@ paths: responses: '200': $ref: 'ogcapi-records-1-building-blocks.yaml#/components/responses/ConformanceDeclaration' - '500': + '4XX': + $ref: 'ogcapi-records-1-building-blocks.yaml#/components/responses/BadRequest' + '406': + $ref: 'ogcapi-records-1-building-blocks.yaml#/components/responses/NotAcceptable' + '5XX': $ref: 'ogcapi-records-1-building-blocks.yaml#/components/responses/ServerError' '/collections': get: @@ -89,7 +97,11 @@ paths: responses: '200': $ref: 'ogcapi-records-1-building-blocks.yaml#/components/responses/Catalogs' - '500': + '4XX': + $ref: 'ogcapi-records-1-building-blocks.yaml#/components/responses/BadRequest' + '406': + $ref: 'ogcapi-records-1-building-blocks.yaml#/components/responses/NotAcceptable' + '5XX': $ref: 'ogcapi-records-1-building-blocks.yaml#/components/responses/ServerError' '/collections/{catalogId}': get: @@ -106,9 +118,13 @@ paths: responses: '200': $ref: 'ogcapi-records-1-building-blocks.yaml#/components/responses/Catalog' + '4XX': + $ref: 'ogcapi-records-1-building-blocks.yaml#/components/responses/BadRequest' '404': $ref: 'ogcapi-records-1-building-blocks.yaml#/components/responses/NotFound' - '500': + '406': + $ref: 'ogcapi-records-1-building-blocks.yaml#/components/responses/NotAcceptable' + '5XX': $ref: 'ogcapi-records-1-building-blocks.yaml#/components/responses/ServerError' '/collections/{catalogId}/sortables': get: @@ -125,9 +141,13 @@ paths: responses: '200': $ref: 'ogcapi-records-1-building-blocks.yaml#/components/responses/Sortables' + '4XX': + $ref: 'ogcapi-records-1-building-blocks.yaml#/components/responses/BadRequest' '404': $ref: 'ogcapi-records-1-building-blocks.yaml#/components/responses/NotFound' - '500': + '406': + $ref: 'ogcapi-records-1-building-blocks.yaml#/components/responses/NotAcceptable' + '5XX': $ref: 'ogcapi-records-1-building-blocks.yaml#/components/responses/ServerError' '/collections/{catalogId}/items': get: @@ -156,11 +176,13 @@ paths: responses: '200': $ref: 'ogcapi-records-1-building-blocks.yaml#/components/responses/Records' - '400': - $ref: 'ogcapi-records-1-building-blocks.yaml#/components/responses/InvalidParameter' + '4XX': + $ref: 'ogcapi-records-1-building-blocks.yaml#/components/responses/BadRequest' '404': $ref: 'ogcapi-records-1-building-blocks.yaml#/components/responses/NotFound' - '500': + '406': + $ref: 'ogcapi-records-1-building-blocks.yaml#/components/responses/NotAcceptable' + '5XX': $ref: 'ogcapi-records-1-building-blocks.yaml#/components/responses/ServerError' '/collections/{catalogId}/items/{recordId}': get: @@ -179,7 +201,18 @@ paths: responses: '200': $ref: 'ogcapi-records-1-building-blocks.yaml#/components/responses/Record' + '4XX': + $ref: 'ogcapi-records-1-building-blocks.yaml#/components/responses/BadRequest' '404': $ref: 'ogcapi-records-1-building-blocks.yaml#/components/responses/NotFound' - '500': + '406': + $ref: 'ogcapi-records-1-building-blocks.yaml#/components/responses/NotAcceptable' + '5XX': $ref: 'ogcapi-records-1-building-blocks.yaml#/components/responses/ServerError' +components: + securitySchemes: + openIdConnect: + type: "openIdConnect" + openIdConnectUrl: "https://accounts.google.com/.well-known/openid-configuration" +security: + - openIdConnect: [] diff --git a/core/openapi/ogcapi-records-1-example-ref-schema-repo.yaml b/core/openapi/ogcapi-records-1-example-ref-schema-repo.yaml index 3166a5c1..bc8ba925 100644 --- a/core/openapi/ogcapi-records-1-example-ref-schema-repo.yaml +++ b/core/openapi/ogcapi-records-1-example-ref-schema-repo.yaml @@ -62,7 +62,11 @@ paths: responses: '200': $ref: 'responses/LandingPage.yaml' - '500': + '4XX': + $ref: 'responses/BadRequest.yaml' + '406': + $ref: 'responses/NotAcceptable.yaml' + '5XX': $ref: 'responses/ServerError.yaml' '/conformance': get: @@ -76,7 +80,11 @@ paths: responses: '200': $ref: 'responses/ConformanceDeclaration.yaml' - '500': + '4XX': + $ref: 'responses/BadRequest.yaml' + '406': + $ref: 'responses/NotAcceptable.yaml' + '5XX': $ref: 'responses/ServerError.yaml' '/collections': get: @@ -89,6 +97,10 @@ paths: responses: '200': $ref: 'responses/Catalogs.yaml' + '4XX': + $ref: 'responses/BadRequest.yaml' + '406': + $ref: 'responses/NotAcceptable.yaml' '500': $ref: 'responses/ServerError.yaml' '/collections/{catalogId}': @@ -105,9 +117,13 @@ paths: responses: '200': $ref: 'responses/Catalog.yaml' + '4XX': + $ref: 'responses/BadRequest.yaml' '404': $ref: 'responses/NotFound.yaml' - '500': + '406': + $ref: 'responses/NotAcceptable.yaml' + '5XX': $ref: 'responses/ServerError.yaml' '/collections/{catalogId}/sortables': get: @@ -124,9 +140,13 @@ paths: responses: '200': $ref: 'responses/Sortables.yaml' + '4XX': + $ref: 'responses/BadRequest.yaml' '404': $ref: 'responses/NotFound.yaml' - '500': + '406': + $ref: 'responses/NotAcceptable.yaml' + '5XX': $ref: 'responses/ServerError.yaml' '/collections/{catalogId}/items': get: @@ -155,11 +175,13 @@ paths: responses: '200': $ref: 'responses/Records.yaml' - '400': - $ref: 'responses/InvalidParameter.yaml' + '4XX': + $ref: 'responses/BadRequest.yaml' '404': $ref: 'responses/NotFound.yaml' - '500': + '406': + $ref: 'responses/NotAcceptable.yaml' + '5XX': $ref: 'responses/ServerError.yaml' '/collections/{catalogId}/items/{recordId}': get: @@ -178,7 +200,18 @@ paths: responses: '200': $ref: 'responses/Record.yaml' + '4XX': + $ref: 'responses/BadRequest.yaml' '404': $ref: 'responses/NotFound.yaml' - '500': + '406': + $ref: 'responses/NotAcceptable.yaml' + '5XX': $ref: 'responses/ServerError.yaml' +components: + securitySchemes: + openIdConnect: + type: "openIdConnect" + openIdConnectUrl: "https://accounts.google.com/.well-known/openid-configuration" +security: + - openIdConnect: [] diff --git a/core/openapi/parameters/language.yaml b/core/openapi/parameters/language.yaml index 7f3e437e..2ff7ba37 100644 --- a/core/openapi/parameters/language.yaml +++ b/core/openapi/parameters/language.yaml @@ -16,7 +16,6 @@ schema: The language tag as per RFC 5646, with optional priority parameter `q` (0 - 1). pattern: "^((?:(en-GB-oed|i-ami|i-bnn|i-default|i-enochian|i-hak|i-klingon|i-lux|i-mingo|i-navajo|i-pwn|i-tao|i-tay|i-tsu|sgn-BE-FR|sgn-BE-NL|sgn-CH-DE)|(art-lojban|cel-gaulish|no-bok|no-nyn|zh-guoyu|zh-hakka|zh-min|zh-min-nan|zh-xiang))|((?:([A-Za-z]{2,3}(-(?:[A-Za-z]{3}(-[A-Za-z]{3}){0,2}))?)|[A-Za-z]{4}|[A-Za-z]{5,8})(-(?:[A-Za-z]{4}))?(-(?:[A-Za-z]{2}|[0-9]{3}))?(-(?:[A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3}))*(-(?:[0-9A-WY-Za-wy-z](-[A-Za-z0-9]{2,8})+))*(-(?:x(-[A-Za-z0-9]{1,8})+))?)|(?:x(-[A-Za-z0-9]{1,8})+))(?:;q=(?:1|1\\.0+|0|0\\.[0-9]+))?$" - examples: - - 'de;q=0.7' + example: 'de;q=0.7' explode: false style: form diff --git a/core/openapi/responses/BadRequest.yaml b/core/openapi/responses/BadRequest.yaml new file mode 100644 index 00000000..83826068 --- /dev/null +++ b/core/openapi/responses/BadRequest.yaml @@ -0,0 +1,10 @@ +--- +description: + A client error occurred. +content: + application/json: + schema: + $ref: 'https://schemas.opengis.net/ogcapi/features/part1/1.0/openapi/schemas/exception.yaml' + text/html: + schema: + type: string diff --git a/core/openapi/responses/Sortables.yaml b/core/openapi/responses/Sortables.yaml index 153e1795..77fc2296 100644 --- a/core/openapi/responses/Sortables.yaml +++ b/core/openapi/responses/Sortables.yaml @@ -4,7 +4,9 @@ description: content: application/json: schema: - $ref: '../schemas/schema.yaml' + type: object + description: + A JSON Schema document that defines all the sortables. text/html: schema: type: string diff --git a/core/openapi/schemas/catalog.yaml b/core/openapi/schemas/catalog.yaml index 36cc4463..a0972e41 100644 --- a/core/openapi/schemas/catalog.yaml +++ b/core/openapi/schemas/catalog.yaml @@ -30,7 +30,7 @@ allOf: - record - catalog type: - descripton: + description: Fixed to catalog for collections of records and/or subordinate catalogs. type: string diff --git a/core/openapi/schemas/contact.yaml b/core/openapi/schemas/contact.yaml index 6ab6984b..c127d930 100644 --- a/core/openapi/schemas/contact.yaml +++ b/core/openapi/schemas/contact.yaml @@ -52,7 +52,7 @@ properties: type: string description: The value is the phone number itself. pattern: "^\\+[1-9]{1}[0-9]{3,14}$" - examples: + example: - "+14165550142" roles: description: @@ -113,7 +113,7 @@ properties: hoursOfService: type: string description: Time period when the contact can be contacted. - examples: + example: - "Hours: Mo-Fr 10am-7pm Sa 10am-22pm Su 10am-21pm" contactInstructions: type: string diff --git a/core/openapi/schemas/language.yaml b/core/openapi/schemas/language.yaml index e905e63a..a31feaf8 100644 --- a/core/openapi/schemas/language.yaml +++ b/core/openapi/schemas/language.yaml @@ -9,21 +9,21 @@ properties: type: string description: The language tag as per RFC-5646. - examples: + example: - "el" name: type: string minLength: 1 description: The untranslated name of the language. - examples: + example: - "Ελληνικά" alternate: type: string description: The name of the language in another well-understood language, usually English. - examples: + example: - "Greek" dir: type: string diff --git a/core/openapi/schemas/linkBase.yaml b/core/openapi/schemas/linkBase.yaml index 37a8cec8..adb76325 100644 --- a/core/openapi/schemas/linkBase.yaml +++ b/core/openapi/schemas/linkBase.yaml @@ -4,26 +4,30 @@ properties: rel: type: string description: The type or semantics of the relation. - example: "alternate" + example: + - "alternate" type: type: string description: A hint indicating what the media type of the result of dereferencing the link should be. - example: "application/geo+json" + example: + - "application/geo+json" hreflang: type: string description: A hint indicating what the language of the result of dereferencing the link should be. - example: "en" + example: + - "en" title: type: string description: Used to label the destination of a link such that it can be used as a human-readable identifier. - example: "Trierer Strasse 70, 53115 Bonn" + example: + - "Trierer Strasse 70, 53115 Bonn" length: type: integer created: diff --git a/core/openapi/schemas/linkTemplate.yaml b/core/openapi/schemas/linkTemplate.yaml index 2080ed96..0bd4d798 100644 --- a/core/openapi/schemas/linkTemplate.yaml +++ b/core/openapi/schemas/linkTemplate.yaml @@ -10,7 +10,8 @@ allOf: description: Supplies a resolvable URI to a remote resource (or resource fragment). - example: "http://data.example.com/buildings/(building-id}" + example: + - "http://data.example.com/buildings/(building-id}" varBase: type: string description: diff --git a/core/openapi/schemas/time.yaml b/core/openapi/schemas/time.yaml index 20854b2a..0589dc94 100644 --- a/core/openapi/schemas/time.yaml +++ b/core/openapi/schemas/time.yaml @@ -25,5 +25,5 @@ properties: type: string description: Minimum time period resolvable in the dataset, as an ISO 8601 duration - examples: + example: - "P1D"