rules: # INFO / METADATA info-title-prefix: description: API title must start with "Amazon Clean Rooms" severity: error given: "$.info.title" then: function: pattern functionOptions: match: "^Amazon Clean Rooms" info-description-required: description: Info object must have a description severity: error given: "$.info" then: field: description function: truthy info-version-required: description: API must have a version severity: error given: "$.info" then: field: version function: truthy info-contact-required: description: API must have contact information severity: warn given: "$.info" then: field: contact function: truthy # OPENAPI VERSION openapi-version: description: Must use OpenAPI 3.x severity: error given: "$" then: field: openapi function: pattern functionOptions: match: "^3\\." # SERVERS servers-required: description: API must define at least one server severity: error given: "$" then: field: servers function: truthy servers-https-only: description: All server URLs must use HTTPS severity: error given: "$.servers[*].url" then: function: pattern functionOptions: match: "^https://" # PATHS paths-kebab-case: description: Path segments should use kebab-case severity: warn given: "$.paths[*]~" then: function: pattern functionOptions: match: "^(/[a-z][a-zA-Z0-9-]*|/{[a-zA-Z][a-zA-Z0-9]*})*$" # OPERATIONS operation-operationId-required: description: Every operation must have an operationId severity: error given: "$.paths[*][get,post,put,patch,delete]" then: field: operationId function: truthy operation-operationId-pascal-case: description: operationId must use PascalCase (AWS convention) severity: warn given: "$.paths[*][get,post,put,patch,delete].operationId" then: function: pattern functionOptions: match: "^[A-Z][a-zA-Z0-9]+$" operation-summary-required: description: Every operation must have a summary severity: error given: "$.paths[*][get,post,put,patch,delete]" then: field: summary function: truthy operation-summary-prefix: description: Operation summaries must start with "Amazon Clean Rooms" severity: warn given: "$.paths[*][get,post,put,patch,delete].summary" then: function: pattern functionOptions: match: "^Amazon Clean Rooms" operation-description-required: description: Every operation must have a description severity: error given: "$.paths[*][get,post,put,patch,delete]" then: field: description function: truthy operation-tags-required: description: Every operation must have at least one tag severity: error given: "$.paths[*][get,post,put,patch,delete]" then: field: tags function: truthy # PARAMETERS parameter-description-required: description: All parameters must have descriptions severity: warn given: "$.paths[*][get,post,put,patch,delete].parameters[*]" then: field: description function: truthy parameter-camel-case: description: Path and query parameters should use camelCase (AWS convention) severity: warn given: "$.paths[*][get,post,put,patch,delete].parameters[*].name" then: function: pattern functionOptions: match: "^[a-z][a-zA-Z0-9]*$" # RESPONSES response-success-required: description: Every operation must have a success response severity: error given: "$.paths[*][get,post,put,patch,delete]" then: field: responses function: truthy response-description-required: description: All response codes must have descriptions severity: error given: "$.paths[*][get,post,put,patch,delete].responses[*]" then: field: description function: truthy response-400-required: description: Operations should document 400 bad request severity: warn given: "$.paths[*][post,put,patch].responses" then: field: "400" function: truthy response-403-required: description: Operations should document 403 access denied severity: warn given: "$.paths[*][get,post,put,patch,delete].responses" then: field: "403" function: truthy response-500-required: description: Operations should document 500 internal server error severity: warn given: "$.paths[*][get,post,put,patch,delete].responses" then: field: "500" function: truthy # SCHEMAS schema-description-on-top-level: description: Top-level component schemas should have descriptions severity: warn given: "$.components.schemas[*]" then: field: description function: truthy # SECURITY security-schemes-defined: description: Security schemes must be defined severity: warn given: "$.components" then: field: securitySchemes function: truthy security-global-defined: description: Global security must be defined severity: warn given: "$" then: field: security function: truthy # HTTP METHOD CONVENTIONS get-no-request-body: description: GET operations must not have a request body severity: error given: "$.paths[*].get" then: field: requestBody function: falsy delete-returns-200-or-204: description: DELETE operations should return 200 or 204 severity: warn given: "$.paths[*].delete.responses" then: function: schema functionOptions: schema: anyOf: - required: ["200"] - required: ["204"] # GENERAL QUALITY no-empty-descriptions: description: Descriptions must not be empty strings severity: error given: "$..description" then: function: truthy microcks-operation-present: description: Operations should have x-microcks-operation extension severity: info given: "$.paths[*][get,post,put,patch,delete]" then: field: x-microcks-operation function: truthy pagination-uses-next-token: description: List operations should use nextToken for pagination (AWS convention) severity: info given: "$.paths[*].get.parameters[?(@.name == 'nextToken')]" then: field: name function: truthy