extends: spectral:oas rules: travelers-operation-summary-title-case: description: All operation summaries must use Title Case severity: warn given: "$.paths[*][*].summary" then: function: pattern functionOptions: match: "^[A-Z][a-zA-Z]*(\\s[A-Z][a-zA-Z]*)*$" travelers-operationid-required: description: All operations must have an operationId severity: error given: "$.paths[*][*]" then: field: operationId function: truthy travelers-tags-required: description: All operations must have tags severity: warn given: "$.paths[*][*]" then: field: tags function: truthy travelers-oauth2-required: description: Insurance API should use OAuth2 authentication severity: warn given: "$.components.securitySchemes[*]" then: field: type function: enumeration functionOptions: values: - oauth2 - http travelers-response-200-get: description: GET operations must have a 200 response severity: error given: "$.paths[*].get.responses" then: field: "200" function: truthy travelers-response-201-post: description: POST operations that create resources should return 201 severity: warn given: "$.paths[*].post.responses" then: field: "201" function: truthy travelers-claim-number-in-path: description: Claim endpoints should use claim_number as path parameter severity: hint given: "$.paths['/claims/{claim_number}'][*].parameters[*][?(@.name=='id')]" then: function: falsy travelers-policy-type-enum: description: Policy types should be validated against known types severity: warn given: "$.components.schemas[*].properties.policy_type" then: field: enum function: truthy travelers-date-format: description: Date fields should use ISO 8601 date format severity: warn given: "$.components.schemas[*].properties[?(@.format=='date')]" then: field: format function: enumeration functionOptions: values: - date - date-time travelers-data-wrapper: description: Responses should wrap content in a data property severity: warn given: "$.components.schemas[?(@property.match(/Response$/))].properties" then: field: data function: truthy travelers-amount-format: description: Monetary amount fields should use number format float severity: hint given: "$.components.schemas[*].properties[?(@.property.match(/amount|premium|incurred/i))]" then: field: format function: enumeration functionOptions: values: - float - double