diff --git a/.redocly.lint-ignore.yaml b/.redocly.lint-ignore.yaml new file mode 100644 index 0000000..1b8846d --- /dev/null +++ b/.redocly.lint-ignore.yaml @@ -0,0 +1,11 @@ +# This file instructs Redocly's linter to ignore the rules contained for specific parts of your API. +# See https://redoc.ly/docs/cli/ for more information. +docs/openapi.yaml: + no-unused-components: + # the created response's headers are used but + # since the bodies are not empty, the entire + # response is not used anywhere. However, for consistency + # and to keep the individual responses DRY, we want + # to keep the 201 in the root openapi file, so we + # disable the unused component rule for this response + - '#/components/responses/201' diff --git a/.spectral.yaml b/.spectral.yaml index f8f312b..f818751 100644 --- a/.spectral.yaml +++ b/.spectral.yaml @@ -51,4 +51,15 @@ rules: - field: "422" function: truthy - field: "422.content.application/problem+json" - function: truthy \ No newline at end of file + function: truthy +overrides: + - files: + # the created response's headers are used but + # since the bodies are not empty, the entire + # response is not used anywhere. However, for consistency + # and to keep the individual responses DRY, we want + # to keep the 201 in the root openapi file, so we + # disable the unused component rule for this response + - "docs/openapi.yaml#/components/responses/201" + rules: + oas3-unused-component: "off" diff --git a/docs/_data/components/responses/read-head.yaml b/docs/_data/components/responses/read-head.yaml deleted file mode 100644 index c896bbe..0000000 --- a/docs/_data/components/responses/read-head.yaml +++ /dev/null @@ -1,21 +0,0 @@ -'200': - $ref: '../../openapi-split.yaml#/components/responses/200' -'304': - $ref: '../../openapi-split.yaml#/components/responses/304' -'400': - $ref: '../../openapi-split.yaml#/components/responses/400' -'401': - $ref: '../../openapi-split.yaml#/components/responses/401' -'403': - $ref: '../../openapi-split.yaml#/components/responses/403' -'404': - $ref: '../../openapi-split.yaml#/components/responses/404' -'406': - $ref: '../../openapi-split.yaml#/components/responses/406' -'410': - $ref: '../../openapi-split.yaml#/components/responses/410' -'429': - $ref: '../../openapi-split.yaml#/components/responses/429' -'500': &unexpected-error - $ref: '../../openapi-split.yaml#/components/responses/500' -default: *unexpected-error \ No newline at end of file diff --git a/docs/_data/openapi-split.yaml b/docs/_data/openapi-split.yaml index 3be31e7..17e8396 100644 --- a/docs/_data/openapi-split.yaml +++ b/docs/_data/openapi-split.yaml @@ -228,10 +228,16 @@ components: $ref: '#/components/headers/X-Rate-Limit-Reset' '204': description: Operation successful. No Content. - headers: + headers: &accepted-headers <<: *rate-limited-headers ETag: $ref: "#/components/headers/ETag" + '201': + description: Created. + headers: + <<: *accepted-headers + Location: + $ref: "#/components/headers/Location" # responses allowing content '400-problem': diff --git a/docs/_data/paths/rating-proposals_forecasts.yaml b/docs/_data/paths/rating-proposals_forecasts.yaml index 607d827..956ad42 100644 --- a/docs/_data/paths/rating-proposals_forecasts.yaml +++ b/docs/_data/paths/rating-proposals_forecasts.yaml @@ -76,6 +76,7 @@ patch: that is advantageous from a performance or reliable delivery perspective. requestBody: + required: true content: application/vnd.trolie.rating-forecast-proposal.v1+json: schema: diff --git a/docs/_data/paths/rating-proposals_realtime.yaml b/docs/_data/paths/rating-proposals_realtime.yaml index eeea872..f06cf65 100644 --- a/docs/_data/paths/rating-proposals_realtime.yaml +++ b/docs/_data/paths/rating-proposals_realtime.yaml @@ -85,6 +85,7 @@ post: tags: *tags requestBody: + required: true content: application/vnd.trolie.rating-realtime-proposal.v1+json: schema: diff --git a/docs/_data/paths/seasonal-overrides.yaml b/docs/_data/paths/seasonal-overrides.yaml index d8fba46..9e1ceff 100644 --- a/docs/_data/paths/seasonal-overrides.yaml +++ b/docs/_data/paths/seasonal-overrides.yaml @@ -58,6 +58,7 @@ post: summary: *post_desc tags: *tags requestBody: + required: true content: application/vnd.trolie.seasonal-override.v1+json: schema: @@ -74,14 +75,7 @@ post: example: $ref: ../../example-narratives/examples/seasonal-override-get.json headers: - X-Rate-Limit-Limit: - $ref: '../openapi-split.yaml#/components/headers/X-Rate-Limit-Limit' - X-Rate-Limit-Remaining: - $ref: '../openapi-split.yaml#/components/headers/X-Rate-Limit-Remaining' - X-Rate-Limit-Reset: - $ref: '../openapi-split.yaml#/components/headers/X-Rate-Limit-Reset' - Location: - $ref: '../openapi-split.yaml#/components/headers/Location' + $ref: '../openapi-split.yaml#/components/responses/201/headers' '400': *malformed '401': *unauthorized-empty diff --git a/docs/_data/paths/seasonal-overrides_{id}.yaml b/docs/_data/paths/seasonal-overrides_{id}.yaml index 17e4b60..1784c9d 100644 --- a/docs/_data/paths/seasonal-overrides_{id}.yaml +++ b/docs/_data/paths/seasonal-overrides_{id}.yaml @@ -80,6 +80,7 @@ put: parameters: - $ref: ../components/parameters/id.yaml requestBody: + required: true content: application/vnd.trolie.seasonal-override.v1+json: schema: diff --git a/docs/_data/paths/temporary-aar-exceptions.yaml b/docs/_data/paths/temporary-aar-exceptions.yaml index 7aa078e..fe2b97a 100644 --- a/docs/_data/paths/temporary-aar-exceptions.yaml +++ b/docs/_data/paths/temporary-aar-exceptions.yaml @@ -56,6 +56,7 @@ post: summary: *post_desc tags: *tags requestBody: + required: true content: application/vnd.trolie.temporary-aar-exception.v1+json: schema: @@ -72,14 +73,8 @@ post: example: $ref: ../../example-narratives/examples/temporary-aar-exception-get.json headers: - X-Rate-Limit-Limit: - $ref: '../openapi-split.yaml#/components/headers/X-Rate-Limit-Limit' - X-Rate-Limit-Remaining: - $ref: '../openapi-split.yaml#/components/headers/X-Rate-Limit-Remaining' - X-Rate-Limit-Reset: - $ref: '../openapi-split.yaml#/components/headers/X-Rate-Limit-Reset' - Location: - $ref: '../openapi-split.yaml#/components/headers/Location' + $ref: '../openapi-split.yaml#/components/responses/201/headers' + '400': *malformed '401': *unauthorized-empty '403': *forbidden-empty diff --git a/docs/_data/paths/temporary-aar-exceptions_{id}.yaml b/docs/_data/paths/temporary-aar-exceptions_{id}.yaml index 9345670..c26f2d7 100644 --- a/docs/_data/paths/temporary-aar-exceptions_{id}.yaml +++ b/docs/_data/paths/temporary-aar-exceptions_{id}.yaml @@ -80,6 +80,7 @@ put: parameters: - $ref: ../components/parameters/id.yaml requestBody: + required: true content: application/vnd.trolie.temporary-aar-exception.v1+json: schema: