extends: spectral:oas rules: # Rook S3-compatible API conventions rook-operation-summary-title-case: description: All operation summaries must use Title Case message: "Operation summary '{{value}}' must use Title Case" severity: warn given: "$.paths[*][*].summary" then: function: pattern functionOptions: match: "^[A-Z][^a-z]*([A-Z][^A-Z]*)*$|^([A-Z][a-z]*(\\s[A-Z]?[a-z]*)*[A-Z]?[a-z]*)$" rook-operation-id-camel-case: description: operationId must use camelCase message: "operationId '{{value}}' should use camelCase" severity: warn given: "$.paths[*][*].operationId" then: function: pattern functionOptions: match: "^[a-z][a-zA-Z0-9]*$" rook-s3-path-bucket-required: description: S3 paths with /{key} must also include /{bucket} parameter message: "S3 path operations on objects must define the 'bucket' path parameter" severity: error given: "$.paths[*][get,put,delete,head].parameters[?(@.in == 'path')]" then: field: name function: enumeration functionOptions: values: - bucket - key rook-s3-response-xml-content-type: description: S3-compatible responses should use application/xml content type message: "S3 object storage responses should declare application/xml or application/octet-stream content types" severity: info given: "$.paths[*][*].responses[*].content" then: function: truthy rook-operation-description-required: description: All operations must have a description message: "Operation is missing a description" severity: warn given: "$.paths[*][get,put,post,delete,head]" then: field: description function: truthy rook-tags-title-case: description: All tags must use Title Case message: "Tag '{{value}}' must use Title Case" severity: warn given: "$.paths[*][*].tags[*]" then: function: pattern functionOptions: match: "^[A-Z]" rook-error-response-schema: description: Error responses should reference an ErrorResponse schema message: "4xx and 5xx responses should include an error response schema" severity: info given: "$.paths[*][*].responses[4xx,5xx]" then: field: content function: truthy rook-server-defined: description: At least one server must be defined message: "OpenAPI spec must define at least one server" severity: error given: "$" then: field: servers function: truthy rook-info-contact: description: Info object must include contact information message: "OpenAPI info must include a contact block" severity: warn given: "$.info" then: field: contact function: truthy