-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
doc: improve API documentation (descriptions, summary, examples) (#567)
- Loading branch information
Showing
133 changed files
with
1,993 additions
and
526 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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Run Spectral on Pull Requests | ||
|
||
on: | ||
- pull_request | ||
|
||
jobs: | ||
build: | ||
name: Run Spectral | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Check out the repository | ||
- uses: actions/checkout@v3 | ||
|
||
# Run Spectral | ||
- uses: stoplightio/spectral-action@latest | ||
with: | ||
file_glob: 'src/main/resources/swagger.api/*.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,157 @@ | ||
extends: [ "spectral:oas" ] | ||
aliases: | ||
PathItem: | ||
description: '' | ||
targets: | ||
- formats: | ||
- oas2 | ||
given: | ||
- "$.paths[*]" | ||
- formats: | ||
- oas3 | ||
given: | ||
- "$.paths[*]" | ||
OperationObject: | ||
description: 'The complete operation object. Use it in combo with field object.' | ||
targets: | ||
- formats: | ||
- oas2 | ||
given: | ||
- "#PathItem[get,put,post,delete,options,head,patch,trace]" | ||
- formats: | ||
- oas3 | ||
given: | ||
- "#PathItem[get,put,post,delete,options,head,patch,trace]" | ||
DescribableObjects: | ||
description: '' | ||
targets: | ||
- formats: | ||
- oas2 | ||
given: | ||
- "$.info" | ||
- "$.tags[*]" | ||
- "#OperationObject" | ||
- "$.paths[*][*].responses[*]" | ||
- "$..parameters[?(@ && @.in)]" | ||
- "$.definitions[*]" | ||
- formats: | ||
- oas3 | ||
given: | ||
- "$.info" | ||
- "$.tags[*]" | ||
- "#OperationObject" | ||
- "$.paths[*][*].responses[*]" | ||
- "$..parameters[?(@ && @.in)]" | ||
- "$.components.schemas[*]" | ||
- "$.servers[*]" | ||
MediaTypeObjects: | ||
description: '' | ||
targets: | ||
- formats: | ||
- oas2 | ||
given: | ||
- $.paths[*][*]..parameters[?(@ && @.in == "body")] | ||
- "$.paths[*][*].responses[*]" | ||
- formats: | ||
- oas3 | ||
given: | ||
- "$.paths[*][*].requestBody.content[*]" | ||
- "$.paths[*][*].responses[*].content[*]" | ||
rules: | ||
docs-descriptions: | ||
given: | ||
- "#DescribableObjects" | ||
severity: warn | ||
then: | ||
- function: truthy | ||
field: description | ||
- function: length | ||
functionOptions: | ||
min: 10 | ||
field: description | ||
- function: pattern | ||
functionOptions: | ||
match: "/^[A-Z]/" | ||
field: description | ||
description: "Descriptions should be provided for describable objects, such as `info`, `tags`, `operations`, `parameters`, and more." | ||
message: "{{error}}." | ||
docs-info-contact: | ||
given: | ||
- "$" | ||
severity: warn | ||
then: | ||
function: truthy | ||
field: info.contact | ||
description: "`Info` object should include contact information." | ||
docs-parameters-examples-or-schema: | ||
given: | ||
- "$.paths.parameters[*]" | ||
severity: info | ||
then: | ||
function: schema | ||
functionOptions: | ||
schema: | ||
type: object | ||
anyOf: | ||
- required: | ||
- examples | ||
- required: | ||
- schema | ||
description: "Path parameter must contain a defined schema or examples." | ||
message: No example or schema provided for {{property}} | ||
formats: | ||
- oas3 | ||
docs-summary: | ||
given: | ||
- "#PathItem[*]" | ||
severity: error | ||
then: | ||
- function: truthy | ||
field: summary | ||
description: "Path parameter must contain a defined schema or examples." | ||
message: No summary provided for {{property}} | ||
formats: | ||
- oas3 | ||
docs-media-types-examples-or-schema: | ||
given: | ||
- "#MediaTypeObjects" | ||
severity: info | ||
then: | ||
function: schema | ||
functionOptions: | ||
schema: | ||
type: object | ||
anyOf: | ||
- required: | ||
- examples | ||
- required: | ||
- schema | ||
description: "Media object must contain a defined schema or examples." | ||
message: No example or schema provided for {{property}} | ||
formats: | ||
- oas3 | ||
docs-tags-alphabetical: | ||
given: | ||
- "$" | ||
severity: warn | ||
then: | ||
function: alphabetical | ||
functionOptions: | ||
keyedBy: name | ||
field: tags | ||
description: "Tags are not in alphabetical order." | ||
message: Tags should be defined in alphabetical order | ||
docs-operation-tags: | ||
given: | ||
- "#OperationObject" | ||
severity: warn | ||
then: | ||
function: schema | ||
functionOptions: | ||
schema: | ||
type: array | ||
minItems: 1 | ||
field: tags | ||
description: "Operation must have at least one tag." | ||
message: Operation should have non-empty `tags` array. | ||
|
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
6 changes: 6 additions & 0 deletions
6
src/main/resources/swagger.api/examples/request/browseConfigUpdateRequest.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,6 @@ | ||
value: | ||
id: all | ||
shelvingAlgorithm: default | ||
typeIds: | ||
- 7e5684a9-c8c1-4c1e-85b9-d047f53eeb6d | ||
- 1faf5a71-01cc-4f14-82e8-38e26b6e3071 |
Oops, something went wrong.