From a75c315e50730317099e6026bda78d42d83ecd13 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Mon, 16 Jan 2023 18:56:33 +0000 Subject: [PATCH] chore(release): 1.3.0 [skip ci] # [1.3.0](https://github.com/SPSCommerce/sps-api-standards/compare/v1.2.0...v1.3.0) (2023-01-16) ### Features * URN-like Domain Reference Standards ([#46](https://github.com/SPSCommerce/sps-api-standards/issues/46)) ([f3e2953](https://github.com/SPSCommerce/sps-api-standards/commit/f3e2953c3725b6732f8ddad0baafa572e1a3022b)) --- sps-api-standards.spectral.yml | 59 ++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/sps-api-standards.spectral.yml b/sps-api-standards.spectral.yml index 911cd37..4383c08 100644 --- a/sps-api-standards.spectral.yml +++ b/sps-api-standards.spectral.yml @@ -19,6 +19,65 @@ rules: values: - application/problem+xml - application/problem+json + # domain references (URN-like values) + sps-ref-property-name: + description: Property with the name 'ref' MUST be of type 'sps-ref' following URN-like reference formats. + severity: error + formats: [oas3] + given: '$..[?((@property=== "ref" || @property === "Ref") && @.$ref == null && @.allOf == null && @.oneOf == null)]' + then: + - field: "format" + function: truthy + - field: "format" + function: pattern + functionOptions: + match: 'sps-ref' + sps-ref-schema: + description: Properties following 'sps-ref' format MUST use the standardized schema - maxLength (255), minLength(7), pattern (includes 'sps'), type (string). + message: '{{property}} is not provided or not following required schema values.' + severity: error + formats: [oas3] + given: '$..[?(@property=== "format" && @ == "sps-ref")]^' + then: + - function: schema + functionOptions: + schema: + type: object + required: + - maxLength + - minLength + - type + - pattern + properties: + maxLength: + type: integer + minimum: 255 + maximum: 255 + minLength: + type: integer + minimum: 7 + maximum: 7 + type: + type: string + pattern: + type: string + - field: pattern + function: pattern + functionOptions: + match: 'sps' + - field: type + function: pattern + functionOptions: + match: '^string$' + sps-ref-in-url: + description: Parameters for sps-ref formatted URN-like references SHOULD NOT be used in query or path parameters. + severity: warn + formats: [oas3] + given: '$..[?((@.name == "ref" || @.name == "Ref") && (@.in=="query" || @.in=="path"))]' + then: + field: name + function: falsy + # 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.'