Skip to content

Commit

Permalink
Fixed AAR exception required fields, added missing 415s (#147)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>

---------

Signed-off-by: Christopher Atkins <[email protected]>
Co-authored-by: Christopher Atkins <[email protected]>
  • Loading branch information
getorymckeag and catkins-miso authored Aug 30, 2024
1 parent 0e9ff15 commit bfb278e
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 17 deletions.
12 changes: 6 additions & 6 deletions docs/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions docs/_data/components/schemas/time-bound-static-ratings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ temporary-aar-exception-request:
required:
- resource
- start-time
- continuous-operating-limit
- emergency-operating-limits

temporary-aar-exception:
type: object
Expand Down
10 changes: 10 additions & 0 deletions docs/_data/openapi-split.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions docs/_data/paths/rating-proposals_realtime.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
9 changes: 8 additions & 1 deletion docs/_data/paths/seasonal-overrides.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 11 additions & 5 deletions docs/_data/paths/seasonal-overrides_{id}.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,20 @@ delete:
responses:
'204': &no-content
$ref: '../openapi-split.yaml#/components/responses/204'
'304': &not-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
Expand All @@ -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
Expand Down
9 changes: 8 additions & 1 deletion docs/_data/paths/temporary-aar-exceptions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 10 additions & 4 deletions docs/_data/paths/temporary-aar-exceptions_{id}.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,20 @@ delete:
responses:
'204': &no-content
$ref: '../openapi-split.yaml#/components/responses/204'
'304': &not-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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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."
}
Original file line number Diff line number Diff line change
@@ -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."
}

0 comments on commit bfb278e

Please sign in to comment.