ipfs / pinning-services-api-spec

Standalone, vendor-agnostic Pinning Service API for IPFS ecosystem
https://ipfs.github.io/pinning-services-api-spec/
Creative Commons Zero v1.0 Universal
100 stars 27 forks source link

feat: validate OpenAPI YAML #10

Closed lidel closed 4 years ago

lidel commented 4 years ago

Aims to close #3 by adding relevant Github Action.

Uses spectral OAS linter via https://github.com/github/super-linter

Sample output (with some manually created errors):

Linting [OPENAPI] files...
----------------------------------------------
----------------------------------------------
---------------------------
File:[/github/workspace/ipfs-pinning-service.yaml]
ERROR! Found errors in [spectral] linter!
ERROR:[OpenAPI 3.x detected

/github/workspace/ipfs-pinning-service.yaml
   1:1   warning  openapi-tags                   OpenAPI object should have non-empty `tags` array.
   2:6   warning  info-contact                   Info object should contain `contact` object.
  33:9   warning  operation-operationId          Operation should have an `operationId`.
  36:11  warning  operation-tag-defined          Operation tags should be defined in global tags.
  48:17    error  invalid-ref                    '#/components/responses/BadRequest' does not exist
  50:17    error  invalid-ref                    '#/components/responses/InternalServerError' does not exist
  51:10  warning  operation-operationId          Operation should have an `operationId`.
  54:11  warning  operation-tag-defined          Operation tags should be defined in global tags.
  63:23    error  invalid-ref                    '#/components/schemas/Pin' does not exist
  70:17    error  invalid-ref                    '#/components/responses/Unauthorized' does not exist
  72:17    error  invalid-ref                    '#/components/responses/NotFound' does not exist
  74:17    error  invalid-ref                    '#/components/responses/InsufficientFunds' does not exist
  85:9   warning  operation-operationId          Operation should have an `operationId`.
  88:11  warning  operation-tag-defined          Operation tags should be defined in global tags.
 104:10  warning  operation-operationId          Operation should have an `operationId`.
 106:17    error  invalid-ref                    '#/components/parameters/pinReplicationParam' does not exist
 107:17    error  invalid-ref                    '#/components/parameters/pinMetaParam' does not exist
 110:11  warning  operation-tag-defined          Operation tags should be defined in global tags.
 125:12  warning  operation-operationId          Operation should have an `operationId`.
 128:11  warning  operation-tag-defined          Operation tags should be defined in global tags.
 144:11  warning  oas3-unused-components-schema  Potentially unused components schema has been detected.
  152:9  warning  oas3-unused-components-schema  Potentially unused components schema has been detected.
 158:14  warning  oas3-unused-components-schema  Potentially unused components schema has been detected.
 163:23  warning  oas3-unused-components-schema  Potentially unused components schema has been detected.

✖ 24 problems (8 errors, 16 warnings, 0 infos, 0 hints)]

----------------------------------------------
----------------------------------------------
The script has completed
lidel commented 4 years ago

All green. I'm merging this, so we have more confidence in accepting PRs from the community.