rules: # INFO / METADATA info-title-required: description: Info title must be defined and start with "Albertsons". severity: error given: "$.info.title" then: function: truthy info-description-required: description: Info description must be defined with meaningful content. severity: error given: "$.info.description" then: function: truthy info-version-required: description: API version must be specified. severity: error given: "$.info.version" then: function: truthy info-contact-required: description: Contact information should be provided. severity: warn given: "$.info.contact" then: function: truthy # OPENAPI VERSION openapi-version-3: description: All specs must use OpenAPI 3.x. severity: error given: "$.openapi" then: function: pattern functionOptions: match: "^3\\." # SERVERS servers-required: description: At least one server must be defined. severity: error given: "$.servers" then: function: truthy servers-https-only: description: Server URLs must use HTTPS. severity: error given: "$.servers[*].url" then: function: pattern functionOptions: match: "^https://" # PATHS — NAMING CONVENTIONS paths-kebab-case: description: Path segments must use kebab-case (lowercase with hyphens). severity: warn given: "$.paths[*]~" then: function: pattern functionOptions: match: "^(/[a-z0-9-{}]+)+$" paths-no-trailing-slash: description: Paths must not end with a trailing slash. severity: warn given: "$.paths[*]~" then: function: pattern functionOptions: notMatch: "/$" paths-plural-resource-nouns: description: Resource path segments should use plural nouns. severity: info given: "$.paths[*]~" then: function: pattern functionOptions: match: "^(/[a-z0-9-{}]*s[a-z0-9-{}]*|/[a-z0-9-{}]*)+$" # OPERATIONS operation-summary-required: description: Every operation must have a summary. severity: error given: "$.paths[*][get,post,put,patch,delete].summary" then: function: truthy operation-summary-albertsons-prefix: description: Operation summaries must start with "Albertsons". severity: warn given: "$.paths[*][get,post,put,patch,delete].summary" then: function: pattern functionOptions: match: "^Albertsons" operation-description-required: description: Every operation must have a description. severity: error given: "$.paths[*][get,post,put,patch,delete].description" then: function: truthy operation-operationid-required: description: Every operation must have an operationId. severity: error given: "$.paths[*][get,post,put,patch,delete].operationId" then: function: truthy operation-operationid-camel-case: description: operationId must use camelCase. severity: warn given: "$.paths[*][get,post,put,patch,delete].operationId" then: function: pattern functionOptions: match: "^[a-z][a-zA-Z0-9]+$" operation-tags-required: description: Every operation must have at least one tag. severity: error given: "$.paths[*][get,post,put,patch,delete].tags" then: function: truthy # TAGS tags-global-defined: description: Global tags array should be defined. severity: warn given: "$.tags" then: function: truthy tags-description-required: description: All global tags must have descriptions. severity: warn given: "$.tags[*].description" then: function: truthy # PARAMETERS parameter-description-required: description: All parameters must have descriptions. severity: error given: "$.paths[*][get,post,put,patch,delete].parameters[*].description" then: function: truthy parameter-snake-case: description: Query and path parameter names should use camelCase or snake_case. severity: info given: "$.paths[*][get,post,put,patch,delete].parameters[*].name" then: function: pattern functionOptions: match: "^[a-z][a-zA-Z0-9_]*$" # REQUEST BODIES request-body-content-json: description: Request bodies should use application/json content type. severity: warn given: "$.paths[*][post,put,patch].requestBody.content" then: function: truthy request-body-description: description: Request body content should have a schema with description. severity: info given: "$.paths[*][post,put,patch].requestBody" then: function: truthy # RESPONSES response-success-required: description: Every operation must define at least one 2xx response. severity: error given: "$.paths[*][get,post,put,patch,delete].responses" then: function: schema functionOptions: schema: type: object minProperties: 1 response-401-required: description: Secured endpoints should define a 401 response. severity: warn given: "$.paths[*][get,post,put,patch,delete].responses" then: function: truthy response-description-required: description: All responses must have descriptions. severity: error given: "$.paths[*][get,post,put,patch,delete].responses[*].description" then: function: truthy # SCHEMAS — PROPERTY NAMING schema-description-required: description: Top-level schemas must have descriptions. severity: warn given: "$.components.schemas[*].description" then: function: truthy schema-type-required: description: All schemas must define a type. severity: warn given: "$.components.schemas[*].type" then: function: truthy schema-property-camel-case: description: Schema property names should use camelCase. severity: info given: "$.components.schemas[*].properties[*]~" then: function: pattern functionOptions: match: "^[a-z][a-zA-Z0-9]*$" # SECURITY security-schemes-defined: description: Security schemes must be defined in components. severity: error given: "$.components.securitySchemes" then: function: truthy security-bearer-auth: description: Bearer authentication scheme should be defined. severity: warn given: "$.components.securitySchemes.bearerAuth" then: function: truthy security-operation-defined: description: Each operation should define security requirements. severity: warn given: "$.paths[*][get,post,put,patch,delete].security" then: function: truthy # HTTP METHOD CONVENTIONS get-no-request-body: description: GET operations must not have request bodies. severity: error given: "$.paths[*].get.requestBody" then: function: falsy delete-no-request-body: description: DELETE operations should not have request bodies. severity: warn given: "$.paths[*].delete.requestBody" then: function: falsy # GENERAL QUALITY no-empty-descriptions: description: Descriptions must not be empty strings. severity: error given: "$..description" then: function: pattern functionOptions: match: ".+" examples-encouraged: description: Schema properties should include example values. severity: info given: "$.components.schemas[*].properties[*]" then: function: truthy