From bfb278eaff5b697fe711bd8cf799e6205263d1b3 Mon Sep 17 00:00:00 2001 From: Tory McKeag <143734462+getorymckeag@users.noreply.github.com> Date: Fri, 30 Aug 2024 05:26:18 -0700 Subject: [PATCH] Fixed AAR exception required fields, added missing 415s (#147) * Fixed AAR exception required fields, added missing 415s * Fixing errors * Code review fixes * Fixed linter errors * Added Location to POSTs * align description to example for clarify Signed-off-by: Christopher Atkins <57670484+catkins-miso@users.noreply.github.com> --------- Signed-off-by: Christopher Atkins <57670484+catkins-miso@users.noreply.github.com> Co-authored-by: Christopher Atkins <57670484+catkins-miso@users.noreply.github.com> --- docs/Gemfile.lock | 12 ++++++------ .../schemas/time-bound-static-ratings.yaml | 2 ++ docs/_data/openapi-split.yaml | 10 ++++++++++ docs/_data/paths/rating-proposals_realtime.yaml | 2 ++ docs/_data/paths/seasonal-overrides.yaml | 9 ++++++++- docs/_data/paths/seasonal-overrides_{id}.yaml | 16 +++++++++++----- docs/_data/paths/temporary-aar-exceptions.yaml | 9 ++++++++- .../paths/temporary-aar-exceptions_{id}.yaml | 14 ++++++++++---- .../examples/cant-delete-aar-exception.json | 6 ++++++ .../examples/cant-delete-seasonal-override.json | 6 ++++++ 10 files changed, 69 insertions(+), 17 deletions(-) create mode 100644 docs/example-narratives/examples/cant-delete-aar-exception.json create mode 100644 docs/example-narratives/examples/cant-delete-seasonal-override.json diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock index 068205b..e01fa8e 100644 --- a/docs/Gemfile.lock +++ b/docs/Gemfile.lock @@ -1,7 +1,7 @@ GEM remote: https://rubygems.org/ specs: - activesupport (7.2.0) + activesupport (7.2.1) base64 bigdecimal concurrent-ruby (~> 1.0, >= 1.3.1) @@ -35,10 +35,10 @@ GEM ffi (>= 1.15.0) eventmachine (1.2.7) execjs (2.9.1) - faraday (2.10.1) - faraday-net_http (>= 2.0, < 3.2) + faraday (2.11.0) + faraday-net_http (>= 2.0, < 3.4) logger - faraday-net_http (3.1.1) + faraday-net_http (3.3.0) net-http ffi (1.17.0) forwardable-extended (2.6.0) @@ -246,7 +246,7 @@ GEM rb-fsevent (0.11.2) rb-inotify (0.11.1) ffi (~> 1.0) - rexml (3.3.5) + rexml (3.3.6) strscan rouge (3.30.0) rubyzip (2.3.2) @@ -269,7 +269,7 @@ GEM tzinfo (2.0.6) concurrent-ruby (~> 1.0) unicode-display_width (1.8.0) - uri (0.13.0) + uri (0.13.1) webrick (1.8.1) PLATFORMS diff --git a/docs/_data/components/schemas/time-bound-static-ratings.yaml b/docs/_data/components/schemas/time-bound-static-ratings.yaml index f9b6612..a017b11 100644 --- a/docs/_data/components/schemas/time-bound-static-ratings.yaml +++ b/docs/_data/components/schemas/time-bound-static-ratings.yaml @@ -28,6 +28,8 @@ temporary-aar-exception-request: required: - resource - start-time + - continuous-operating-limit + - emergency-operating-limits temporary-aar-exception: type: object diff --git a/docs/_data/openapi-split.yaml b/docs/_data/openapi-split.yaml index fc17c30..3be31e7 100644 --- a/docs/_data/openapi-split.yaml +++ b/docs/_data/openapi-split.yaml @@ -374,6 +374,16 @@ components: maxLength: 256 additionalProperties: false + Location: + description: > + The "Location" header field is used in some responses to refer to a specific + resource in relation to the response. In TROLIE, this is always associated with + a 201 response (a POST), and therefore refers to the URI of the resource created. + schema: + type: string + format: uri-reference + maxLength: 1000 + X-Rate-Limit-Limit: description: The number of allowed requests in the current period schema: diff --git a/docs/_data/paths/rating-proposals_realtime.yaml b/docs/_data/paths/rating-proposals_realtime.yaml index c5f0c51..eeea872 100644 --- a/docs/_data/paths/rating-proposals_realtime.yaml +++ b/docs/_data/paths/rating-proposals_realtime.yaml @@ -114,6 +114,8 @@ post: '406': *not-acceptable-empty '413': $ref: '../openapi-split.yaml#/components/responses/413-empty' + '415': + $ref: '../openapi-split.yaml#/components/responses/415-problem' '422': description: | diff --git a/docs/_data/paths/seasonal-overrides.yaml b/docs/_data/paths/seasonal-overrides.yaml index a4b81f0..d8fba46 100644 --- a/docs/_data/paths/seasonal-overrides.yaml +++ b/docs/_data/paths/seasonal-overrides.yaml @@ -74,7 +74,14 @@ post: example: $ref: ../../example-narratives/examples/seasonal-override-get.json headers: - $ref: '../openapi-split.yaml#/components/responses/204/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' '400': *malformed '401': *unauthorized-empty diff --git a/docs/_data/paths/seasonal-overrides_{id}.yaml b/docs/_data/paths/seasonal-overrides_{id}.yaml index 0d1de34..17e4b60 100644 --- a/docs/_data/paths/seasonal-overrides_{id}.yaml +++ b/docs/_data/paths/seasonal-overrides_{id}.yaml @@ -51,13 +51,20 @@ delete: responses: '204': &no-content $ref: '../openapi-split.yaml#/components/responses/204' - '304': ¬-modified - $ref: '../openapi-split.yaml#/components/responses/304' '400': *malformed '401': *unauthorized-empty '403': *forbidden-empty '404': *not-found-empty - '406': *not-acceptable-empty + '409': + description: Seasonal overrides already employed in Operations cannot be deleted. + content: + application/problem+json: + schema: + $ref: '../openapi-split.yaml#/components/schemas/problem' + example: + $ref: '../../example-narratives/examples/cant-delete-seasonal-override.json' + headers: + $ref: '../openapi-split.yaml#/components/responses/304/headers' '429': *rate-limit-hit '500': *unexpected-error-empty default: *unexpected-error-empty @@ -80,8 +87,7 @@ put: example: $ref: ../../example-narratives/examples/seasonal-override-get.json responses: - '204': *no-content - '304': *not-modified + '204': *no-content '400': *malformed '401': *unauthorized-empty '403': *forbidden-empty diff --git a/docs/_data/paths/temporary-aar-exceptions.yaml b/docs/_data/paths/temporary-aar-exceptions.yaml index 0cf6dbf..7aa078e 100644 --- a/docs/_data/paths/temporary-aar-exceptions.yaml +++ b/docs/_data/paths/temporary-aar-exceptions.yaml @@ -72,7 +72,14 @@ post: example: $ref: ../../example-narratives/examples/temporary-aar-exception-get.json headers: - $ref: '../openapi-split.yaml#/components/responses/204/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' '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 c3755c1..9345670 100644 --- a/docs/_data/paths/temporary-aar-exceptions_{id}.yaml +++ b/docs/_data/paths/temporary-aar-exceptions_{id}.yaml @@ -51,13 +51,20 @@ delete: responses: '204': &no-content $ref: '../openapi-split.yaml#/components/responses/204' - '304': ¬-modified - $ref: '../openapi-split.yaml#/components/responses/304' '400': *malformed '401': *unauthorized-empty '403': *forbidden-empty '404': *not-found-empty - '406': *not-acceptable-empty + '409': + description: Temporary AAR Exceptions already employed in Operations cannot be deleted. + content: + application/problem+json: + schema: + $ref: '../openapi-split.yaml#/components/schemas/problem' + example: + $ref: '../../example-narratives/examples/cant-delete-aar-exception.json' + headers: + $ref: '../openapi-split.yaml#/components/responses/304/headers' '429': *rate-limit-hit '500': *unexpected-error-empty default: *unexpected-error-empty @@ -81,7 +88,6 @@ put: $ref: ../../example-narratives/examples/temporary-aar-exception-get.json responses: '204': *no-content - '304': *not-modified '400': *malformed '401': *unauthorized-empty '403': *forbidden-empty diff --git a/docs/example-narratives/examples/cant-delete-aar-exception.json b/docs/example-narratives/examples/cant-delete-aar-exception.json new file mode 100644 index 0000000..71f542c --- /dev/null +++ b/docs/example-narratives/examples/cant-delete-aar-exception.json @@ -0,0 +1,6 @@ +{ + "type": "//trolie.example.com/spec/client-errors/409/temporary-aar-exception-in-use", + "title": "Conflict: Temporary AAR Exception in Use", + "status": 409, + "detail": "Temporary AAR Exception with id 'fb06e551-37a8-4a98-8c97-fded702530d6' may not be deleted, as it has been used in rating snapshots and is now part of the record." +} diff --git a/docs/example-narratives/examples/cant-delete-seasonal-override.json b/docs/example-narratives/examples/cant-delete-seasonal-override.json new file mode 100644 index 0000000..1a5a617 --- /dev/null +++ b/docs/example-narratives/examples/cant-delete-seasonal-override.json @@ -0,0 +1,6 @@ +{ + "type": "//trolie.example.com/spec/client-errors/409/seasonal-override-in-use", + "title": "Conflict: Seasonal Override in Use", + "status": 409, + "detail": "Seasonal Override with id 'fb06e551-37a8-4a98-8c97-fded702530d6' may not be deleted, as it has been used in operations and is now part of the record." +}