Skip to content

Commit

Permalink
feat: Delete rules considered overengineering or too strict (#33)
Browse files Browse the repository at this point in the history
Deleted the following linting rules: path-dto-reference, http-verbs-should-be-used, must-have-response-body
  • Loading branch information
markbrockhoff committed Dec 9, 2022
1 parent 49aa26e commit d19b517
Show file tree
Hide file tree
Showing 11 changed files with 0 additions and 292 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ rules:
path-must-match-api-standards: warn
servers-must-match-api-standards: warn
common-responses-unauthorized: warn
http-verbs-should-be-used: warn
no-http-verbs-in-resources: warn
description-is-mandatory: warn
```
Expand Down
32 changes: 0 additions & 32 deletions rules/documentation/path-dto-reference.spec.ts

This file was deleted.

12 changes: 0 additions & 12 deletions rules/documentation/path-dto-reference.yml

This file was deleted.

44 changes: 0 additions & 44 deletions rules/endpoint/http-verbs-should-be-used.spec.ts

This file was deleted.

19 changes: 0 additions & 19 deletions rules/endpoint/http-verbs-should-be-used.yml

This file was deleted.

95 changes: 0 additions & 95 deletions rules/endpoint/must-have-response-body.spec.ts

This file was deleted.

28 changes: 0 additions & 28 deletions rules/endpoint/must-have-response-body.yml

This file was deleted.

4 changes: 0 additions & 4 deletions spectral-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,11 @@ rules:
path-must-match-api-standards: off # Rule is still under discussion and therefore disabled
servers-must-match-api-standards: off # Rule is still under discussion and therefore disabled
common-responses-unauthorized: hint
http-verbs-should-be-used: info
no-http-verbs-in-resources: warn
path-description-is-mandatory: warn
info-description: warn
contact-information: warn
path-dto-reference: warn
must-have-path: warn
must-have-response-body: warn
oas2-must-have-response-body: warn
must-have-content-type: warn
must-define-example-schema: warn
path-must-specify-tags: warn
Expand Down
4 changes: 0 additions & 4 deletions spectral-bff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,11 @@ rules:
path-must-match-api-standards: off # Rule is still under discussion and therefore disabled
servers-must-match-api-standards: off # Rule is still under discussion and therefore disabled
common-responses-unauthorized: hint
http-verbs-should-be-used: off
no-http-verbs-in-resources: info
path-description-is-mandatory: info
info-description: info
contact-information: info
path-dto-reference: info
must-have-path: info
must-have-response-body: info
oas2-must-have-response-body: info
must-have-content-type: info
must-define-example-schema: info
path-must-specify-tags: info
Expand Down
4 changes: 0 additions & 4 deletions spectral-legacy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,11 @@ rules:
path-must-match-api-standards: off # Rule is still under discussion and therefore disabled
servers-must-match-api-standards: off # Rule is still under discussion and therefore disabled
common-responses-unauthorized: hint
http-verbs-should-be-used: off
no-http-verbs-in-resources: info
path-description-is-mandatory: info
info-description: info
contact-information: info
path-dto-reference: info
must-have-path: info
must-have-response-body: info
oas2-must-have-response-body: info
must-have-content-type: info
must-define-example-schema: info
path-must-specify-tags: info
Expand Down
49 changes: 0 additions & 49 deletions spectral.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,6 @@ rules:
function: truthy
- field: url
function: truthy
path-dto-reference:
description: DTOs should be used to specify the schema(data types) of a request / response
message: "{{description}}; property {{property}} is missing"
severity: error
given: $.components.schemas
then:
- function: length
functionOptions:
min: 1
must-have-path:
description: Every API must have at least one path
message: "{{description}}; property `paths` is empty"
Expand All @@ -73,22 +64,6 @@ rules:
then:
- field: '401'
function: truthy
http-verbs-should-be-used:
description: HTTP verbs should be used to express different actions or functions on a resource
message: "{{description}}; The HTTP verb {{property}} is missing."
severity: error
given: $.paths[?(!@property.match(/well-known/ig))]
then:
- field: get
function: truthy
- field: post
function: truthy
- field: put
function: truthy
- field: patch
function: truthy
- field: delete
function: truthy
no-http-verbs-in-resources:
description: The HTTP Verbs should not be used in the route path to define different actions on a resource
message: "{{description}}; {{property}} Instead use HTTP verbs to define actions on a resource. Example: PUT - /digital-twin/api/v1/products/42"
Expand All @@ -108,18 +83,6 @@ rules:
function: truthy
formats:
- oas3
must-have-response-body:
description: Every route returning a http status code of 200 or 201 must have a response body defined
message: "{{description}}; property {{property}} is missing at path: {{path}}"
severity: error
given: $.paths[?(!@property.match(/well-known/ig))].[?(@property === 'get')].responses[200,201,"200","201"]
then:
- field: content
function: truthy
- field: description
function: truthy
formats:
- oas3
must-have-content-type:
description: Every response must specify its content type
message: "{{description}}; property {{property}} is missing or not a valid content-type"
Expand Down Expand Up @@ -157,15 +120,3 @@ rules:
min: 1
formats:
- oas3
oas2-must-have-response-body:
description: Every route returning a http status code of 200 or 201 must have a response body defined
message: "{{description}}; property {{property}} is missing at path: {{path}}"
severity: error
formats:
- oas2
given: $.paths[?(!@property.match(/well-known/ig))].[?(@property === 'get')].responses[200,201,"200","201"]
then:
- field: schema
function: truthy
- field: description
function: truthy

0 comments on commit d19b517

Please sign in to comment.