-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* lint with spectral too * added summaries * attempt at a canonical refactoring for HEAD/GET * local dev config changes * spelling and linting corrections * disable step but keep for future use
- Loading branch information
Showing
67 changed files
with
479 additions
and
281 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,10 +11,11 @@ permissions: | |
|
||
jobs: | ||
build: | ||
name: "Bundle and Build" | ||
name: "Redocly Lint" | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
@@ -25,3 +26,13 @@ jobs: | |
- run: >- | ||
npx --yes @redocly/cli bundle ./docs/_data/openapi-split.yaml -o ./docs/openapi.yaml && | ||
npx @redocly/cli lint ./docs/openapi.yaml | ||
- name: Redocly API Stats | ||
id: api_stats | ||
run: npx @redocly/cli stats ./docs/openapi.yaml > stats.txt 2>&1 | ||
- name: Comment PR with API Stats | ||
#if: ${{ github.event.pull_request }} | ||
if: ${{ false }} | ||
uses: thollander/[email protected] | ||
with: | ||
comment_tag: api-stats | ||
filePath: stats.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
extends: | ||
- spectral:oas | ||
# note this only covers the 2019 top ten https://github.com/stoplightio/spectral-owasp-ruleset/issues/47 | ||
- https://unpkg.com/@stoplight/spectral-owasp-ruleset/dist/ruleset.mjs | ||
rules: | ||
# override a couple of rules that erroneously apply to HEAD requests | ||
"owasp:api3:2019-define-error-responses-500": | ||
message: "Operation is missing {{property}}." | ||
description: OWASP API Security recommends defining schemas for all responses, even errors. The 500 describes what happens when a request fails with an internal server error, so its important to define this not just for documentation, but to empower contract testing to make sure the proper JSON structure is being returned instead of leaking implementation details in backtraces. | ||
given: $.paths.*[get,put,post,patch,delete].responses | ||
then: | ||
- field: "500" | ||
function: truthy | ||
- field: "500.content" | ||
function: truthy | ||
|
||
"owasp:api3:2019-define-error-responses-401": | ||
message: "Operation is missing {{property}}." | ||
description: "OWASP API Security recommends defining schemas for all responses, even errors. The 401 describes what happens when a request is unauthorized, so its important to define this not just for documentation, but to empower contract testing to make sure the proper JSON structure is being returned instead of leaking implementation details in backtraces." | ||
given: $.paths.*[get,put,post,patch,delete].responses | ||
then: | ||
- field: "401" | ||
function: truthy | ||
- field: "401.content" | ||
function: truthy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
ETag: | ||
description: > | ||
An opaque, unique identifier for a specific version of a resource. The modeled | ||
resource state is what is versioned, not the content of any particular | ||
representation. The server MUST use a strong validator so that the same ETag | ||
is returned regardless of the media type of the representation. | ||
schema: | ||
additionalProperties: false | ||
anyOf: | ||
- $ref: ../schemas/hash.yaml | ||
- $ref: ../schemas/origin-id.yaml | ||
|
||
# it seems redocly can't resolve more than 4 $ref deep, so we will repeat these here | ||
X-Rate-Limit-Limit: | ||
description: The number of allowed requests in the current period | ||
schema: | ||
type: integer | ||
format: int32 | ||
minimum: 0 | ||
maximum: 1000 | ||
X-Rate-Limit-Remaining: | ||
description: The number of remaining requests in the current period | ||
schema: | ||
type: integer | ||
format: int32 | ||
minimum: 0 | ||
maximum: 1000 | ||
X-Rate-Limit-Reset: | ||
description: The number of seconds left in the current period | ||
schema: | ||
type: integer | ||
format: int32 | ||
minimum: 0 | ||
maximum: 1000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
description: The number of allowed requests in the current period | ||
schema: | ||
type: integer | ||
format: int32 | ||
minimum: 0 | ||
maximum: 1000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
description: The number of remaining requests in the current period | ||
schema: | ||
type: integer | ||
format: int32 | ||
minimum: 0 | ||
maximum: 1000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
description: The number of seconds left in the current period | ||
schema: | ||
type: integer | ||
format: int32 | ||
minimum: 0 | ||
maximum: 1000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
X-Rate-Limit-Limit: | ||
description: The number of allowed requests in the current period | ||
schema: | ||
type: integer | ||
format: int32 | ||
minimum: 0 | ||
maximum: 1000 | ||
X-Rate-Limit-Remaining: | ||
description: The number of remaining requests in the current period | ||
schema: | ||
type: integer | ||
format: int32 | ||
minimum: 0 | ||
maximum: 1000 | ||
# this would be identical to Retry-After if the latter | ||
# returns seconds to delay (as opposed to an HTTP date time) | ||
Retry-After: | ||
schema: | ||
oneOf: | ||
- type: integer | ||
format: int32 | ||
minimum: 0 | ||
maximum: 60 | ||
example: 60 | ||
description: The seconds to delay after the response is received. | ||
# TODO: the HTTP spec allows for this but we probably should not support it | ||
- type: string | ||
pattern: "^[A-Z][a-z]{2}, \\d{2} [A-Z][a-z]{2} \\d{4} \\d{2}:\\d{2}:\\d{2} GMT$" | ||
maxLength: 30 | ||
example: 'Wed, 21 Oct 2022 07:28:00 GMT' | ||
description: A date after which to retry. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
X-Rate-Limit-Limit: | ||
description: The number of allowed requests in the current period | ||
schema: | ||
type: integer | ||
format: int32 | ||
minimum: 0 | ||
maximum: 1000 | ||
X-Rate-Limit-Remaining: | ||
description: The number of remaining requests in the current period | ||
schema: | ||
type: integer | ||
format: int32 | ||
minimum: 0 | ||
maximum: 1000 | ||
X-Rate-Limit-Reset: | ||
description: The number of seconds left in the current period | ||
schema: | ||
type: integer | ||
format: int32 | ||
minimum: 0 | ||
maximum: 1000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
application/*: | ||
schema: | ||
$ref: ../schemas/empty.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
description: Too many requests (rate limiting) | ||
headers: | ||
$ref: ../headers/rate-limit-hit.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
description: Too many requests (rate limiting) | ||
headers: | ||
$ref: ../headers/rate-limit-hit.yaml | ||
content: | ||
$ref: empty.yaml |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
maxItems: 240 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
maxItems: 10000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
description: Usually the NERC id of the entity. | ||
type: string | ||
maxLength: 10 | ||
pattern: ^[A-Z]{3,10}$ | ||
# I believe SPP uses for some of their market participants who are not NERC registered. | ||
pattern: ^[A-Z\-]{3,10}$ | ||
example: MISO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.