extends: spectral:oas rules: whisky-hunter-no-auth-required: description: The Whisky Hunter API is public and should not declare security requirements. message: Whisky Hunter API operations should not require authentication. severity: warn given: "$.paths.*.*" then: field: security function: falsy whisky-hunter-trailing-slash-paths: description: Whisky Hunter API paths end with a trailing slash per convention. message: Path '{{path}}' should end with a trailing slash per Whisky Hunter convention. severity: warn given: "$.paths.*~" then: function: pattern functionOptions: match: ".*/$" whisky-hunter-format-query-param: description: GET endpoints should support the format query parameter for JSON output. message: GET operation at '{{path}}' should document the format query parameter. severity: warn given: "$.paths.*.get" then: field: parameters function: truthy whisky-hunter-response-200-defined: description: All GET operations must define a 200 response. message: GET operation at '{{path}}' must define a 200 response. severity: error given: "$.paths.*.get" then: field: responses.200 function: truthy whisky-hunter-array-response-for-data-endpoints: description: Data endpoints should return arrays. message: Data endpoint '{{path}}' should return an array in the 200 response schema. severity: warn given: "$.paths.*.get.responses.200.content.application/json.schema" then: function: schema functionOptions: schema: properties: type: enum: - array whisky-hunter-operation-ids-camel-case: description: All operationIds should use camelCase. message: OperationId '{{value}}' should use camelCase. severity: warn given: "$.paths.*.*.operationId" then: function: pattern functionOptions: match: "^[a-z][a-zA-Z0-9]*$" whisky-hunter-tags-on-operations: description: All operations must have at least one tag. message: Operation '{{path}}' must have at least one tag. severity: error given: "$.paths.*.*" then: field: tags function: truthy whisky-hunter-description-on-operations: description: All operations should have a description. message: Operation '{{path}}' is missing a description. severity: warn given: "$.paths.*.*" then: field: description function: truthy whisky-hunter-slug-path-param: description: Distillery data path must use {slug} path parameter. message: Distillery data path should use {slug} path parameter. severity: warn given: "$.paths[?(@property.includes('distillery_data'))].get.parameters[*]" then: field: name function: truthy