Skip to content

Commit

Permalink
chore(release): 1.12.0 [skip ci]
Browse files Browse the repository at this point in the history
# [1.12.0](v1.11.4...v1.12.0) (2024-07-17)

### Features

* **Dpe 135:** naming rules ([#85](#85)) ([cd1301c](cd1301c))
  • Loading branch information
semantic-release-bot committed Jul 17, 2024
1 parent cd1301c commit 7a49a50
Showing 1 changed file with 176 additions and 8 deletions.
184 changes: 176 additions & 8 deletions sps-api-standards.spectral.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,44 @@ rules:
values:
- application/problem+xml
- application/problem+json
# domain references (URN-like values)
##### General #####
sps-no-keyword-conflicts:
description: Names that may conflict with keywords in common programming languages SHOULD NOT be used.
severity: warn
given: "$..properties.*~"
then:
function: pattern
functionOptions:
notMatch: ^(abstract|for|new|switch|assert|default|goto|package|synchronized|boolean|do|if|private|this|break|double|implements|throw|byte|else|import|public|throws|case|enum|instanceof|return|transient|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|volatile|const|float|native|super|while)$
##### Property Names #####
sps-camel-case-properties:
description: Property names and acronyms MUST be in camelCase.
severity: error
formats: [oas3]
given: "$..properties.*~"
then:
function: casing
functionOptions:
type: camel
sps-disallowed-prepositions:
description: Property names SHOULD NOT include prepositions (e.g. "for", "during", "at", etc.)
severity: warn
formats: [oas3]
given: "$..properties.*~"
then:
function: pattern
functionOptions:
notMatch: (^(about|above|across|after|against|among|around|at|before|behind|below|beside|between|down|during|for|from|in|inside|into|near|of|off|on|out|over|through|to|toward|under|up|with|as|but|like|since|than|till|unlike|until|upon|within|without)([A-Z]|$)|.*(About|Above|Across|After|Against|Among|Around|At|Before|Behind|Below|Beside|Between|Down|During|For|From|In|Inside|Into|Near|Of|Off|On|Out|Over|Through|To|Toward|Under|Up|With|As|But|Like|Since|Than|Till|Unlike|Until|Upon|Within|Without)([A-Z]|$)).*
sps-disallowed-boolean-prefixes:
description: Boolean properties SHOULD NOT use is, has, or another prefix.
severity: warn
formats: [oas3]
given: "$..properties[?(@ && @.type == 'boolean')]~"
then:
function: pattern
functionOptions:
notMatch: "^(is|has|was|will|needs|uses|should|can)([A-Z]|$).*"
##### Domain References #####
sps-ref-property-name:
description: Property with the name 'ref' MUST be of type 'sps-ref' following URN-like reference formats.
severity: error
Expand Down Expand Up @@ -70,18 +107,139 @@ rules:
function: pattern
functionOptions:
match: "^string$"
# fingerprint property usage and naming
sps-fingerprint-naming:
description: Rather than property names refering to the implementation for 'hash' or 'hashkey', you MUST use the property name 'fingerprint'.
message: "{{property}} is not using property name fingerprint."
##### Standard Properties #####
sps-invalid-id-type:
description: id SHOULD use a data type of 'string'.
severity: warn
formats: [oas3]
given: '$..[?(@property === "id")].type'
then:
function: pattern
functionOptions:
match: "^string$"
sps-mandate-abbreviations-identifier:
description: Use abbreviations instead of long form names, i.e. identifier SHOULD BE id.
severity: warn
formats: [oas3]
given: '$..properties.*~'
then:
function: pattern
functionOptions:
notMatch: "(^identifier([A-Z]|$)|.*Identifier([A-Z]|$))"
sps-mandate-abbreviations-organization:
description: Use abbreviations instead of long form names, i.e. organization SHOULD BE org.
severity: warn
formats: [oas3]
given: '$..properties.*~'
then:
function: pattern
functionOptions:
notMatch: "(^organization([A-Z]|$)|Organization([A-Z]|$))"
sps-invalid-ref-type:
description: ref MUST use a data type of 'string'.
severity: error
formats: [oas3]
given: "$.components.schemas..properties.*~"
given: '$..[?(@property === "ref")].type'
then:
function: pattern
functionOptions:
notMatch: "^hashkey|hashKey|hash$"
sps-fingerprint-type:
match: "^string$"
sps-invalid-orgid-type:
description: orgId MUST use a data type of 'string'.
severity: error
formats: [oas3]
given: '$..[?(@property === "orgId")].type'
then:
function: pattern
functionOptions:
match: "^string$"
sps-invalid-name-type:
description: name MUST use a data type of 'string'.
severity: error
formats: [oas3]
given: '$..[?(@property === "name")].type'
then:
function: pattern
functionOptions:
match: "^string$"
sps-invalid-description-type:
description: description MUST use a data type of 'string'.
severity: error
formats: [oas3]
given: '$..[?(@property === "description")].type'
then:
function: pattern
functionOptions:
match: "^string$"
sps-invalid-request-id-type:
description: requestId MUST use a data type of 'string'.
severity: error
formats: [oas3]
given: '$..[?(@property === "requestId")].type'
then:
function: pattern
functionOptions:
match: "^string$"
sps-invalid-created-date-time-type:
description: createdDateTime MUST use a data type of 'string' with the format 'date-time'.
severity: error
formats: [oas3]
given: "$..properties.createdDateTime"
then:
- field: type
function: pattern
functionOptions:
match: "^string$"
- field: format
function: truthy
- field: format
function: pattern
functionOptions:
match: "^date-time$"
sps-invalid-created-by-type:
description: createdBy MUST use a data type of 'string'.
severity: error
formats: [oas3]
given: '$..[?(@property === "createdBy")].type'
then:
function: pattern
functionOptions:
match: "^string$"
sps-invalid-modified-date-time-type:
description: modifiedDateTime MUST use a data type of 'string' with the format 'date-time'.
severity: error
formats: [oas3]
given: "$..properties.modifiedDateTime"
then:
- field: type
function: pattern
functionOptions:
match: "^string$"
- field: format
function: truthy
- field: format
function: pattern
functionOptions:
match: "^date-time$"
sps-invalid-modified-by-type:
description: modifiedBy MUST use a data type of 'string'.
severity: error
formats: [oas3]
given: '$..[?(@property === "modifiedBy")].type'
then:
function: pattern
functionOptions:
match: "^string$"
sps-invalid-deleted-by-type:
description: deletedBy MUST use a data type of 'string'.
severity: error
formats: [oas3]
given: '$..[?(@property === "deletedBy")].type'
then:
function: pattern
functionOptions:
match: "^string$"
sps-invalid-fingerprint-type:
description: Fingerprint values MUST use a data type of `string`.
severity: error
formats: [oas3]
Expand All @@ -90,6 +248,16 @@ rules:
function: pattern
functionOptions:
match: "^string$"
sps-fingerprint-naming:
description: Rather than property names refering to the implementation for 'hash' or 'hashkey', you MUST use the property name 'fingerprint'.
message: "{{property}} is not using property name fingerprint."
severity: error
formats: [oas3]
given: "$.components.schemas..properties.*~"
then:
function: pattern
functionOptions:
notMatch: "^hashkey|hashKey|hash$"
##### General #####
sps-invalid-response-body:
description: Response bodies must be an object type.
Expand Down

0 comments on commit 7a49a50

Please sign in to comment.