mirror of
https://github.com/adidas/api-guidelines.git
synced 2025-10-25 15:19:19 +00:00
Merge pull request #31 from azetilov/fix/rest-paths-kebab-case
fix(spectral): use kebab-case for paths
This commit is contained in:
@@ -9,17 +9,27 @@ rules:
|
|||||||
operation-tags: false
|
operation-tags: false
|
||||||
operation-2xx-response: error
|
operation-2xx-response: error
|
||||||
|
|
||||||
adidas-paths-camelCase:
|
adidas-paths-kebab-case:
|
||||||
description: All YAML/JSON paths MUST follow camelCase
|
description: All YAML/JSON paths MUST follow kebab-case
|
||||||
severity: warn
|
severity: warn
|
||||||
recommended: true
|
recommended: true
|
||||||
message: "{{property}} is not camelCase: {{error}}"
|
message: "{{property}} is not kebab-case: {{error}}"
|
||||||
given: $.paths[*]~
|
given: $.paths[*]~
|
||||||
then:
|
then:
|
||||||
function: pattern
|
function: pattern
|
||||||
functionOptions:
|
functionOptions:
|
||||||
# match: "/^(\/{1}(([{]?[a-z])[A-Za-z0-9]*[}]?)*)+$/" # - more generic one, allows /asasd{asdas}sadas pattern but also not closed braces
|
match: "^\/([a-z0-9]+(-[a-z0-9]+)*)?(\/[a-z0-9]+(-[a-z0-9]+)*|\/{.+})*$" # doesn't allow /asasd{asdas}sadas pattern or not closed braces
|
||||||
match: "^\/([a-z][a-zA-Z0-9]+)?(\/[a-z][a-zA-Z0-9]+|\/{[a-z][a-zA-Z0-9]+})*$" # doesn't allow /asasd{asdas}sadas pattern or not closed braces
|
|
||||||
|
adidas-path-parameters-camelCase-alphanumeric:
|
||||||
|
description: Path parameters MUST follow camelCase
|
||||||
|
severity: warn
|
||||||
|
recommended: true
|
||||||
|
message: "{{property}} path parameter is not camelCase: {{error}}"
|
||||||
|
given: $..parameters[?(@.in == 'path')].name
|
||||||
|
then:
|
||||||
|
function: pattern
|
||||||
|
functionOptions:
|
||||||
|
match: "^[a-z][a-zA-Z0-9]+$"
|
||||||
|
|
||||||
adidas-definitions-camelCase-alphanumeric:
|
adidas-definitions-camelCase-alphanumeric:
|
||||||
description: All YAML/JSON definitions MUST follow fields-camelCase and be ASCII alphanumeric characters or `_` or `$`.
|
description: All YAML/JSON definitions MUST follow fields-camelCase and be ASCII alphanumeric characters or `_` or `$`.
|
||||||
@@ -52,17 +62,6 @@ rules:
|
|||||||
functionOptions:
|
functionOptions:
|
||||||
notMatch: "/^body$/"
|
notMatch: "/^body$/"
|
||||||
|
|
||||||
adidas-uri-template-cannot-dash:
|
|
||||||
description: "The 'URI' template (RFC 6570 - https://tools.ietf.org/html/rfc6570) cannot contain a '-' character"
|
|
||||||
severity: error
|
|
||||||
recommended: true
|
|
||||||
message: "{{property}}: {{description}}"
|
|
||||||
given: "$.paths[*]~"
|
|
||||||
then:
|
|
||||||
function: pattern
|
|
||||||
functionOptions:
|
|
||||||
notMatch: "/-/"
|
|
||||||
|
|
||||||
adidas-headers-no-x-headers:
|
adidas-headers-no-x-headers:
|
||||||
description: "All 'HTTP' headers SHOULD NOT include 'X-' headers (https://tools.ietf.org/html/rfc6648)."
|
description: "All 'HTTP' headers SHOULD NOT include 'X-' headers (https://tools.ietf.org/html/rfc6648)."
|
||||||
severity: warn
|
severity: warn
|
||||||
|
|||||||
Reference in New Issue
Block a user