rules: # INFO / METADATA info-title-required: description: Info title must be present severity: error given: "$.info" then: field: title function: truthy info-description-required: description: Info description must be present severity: warn given: "$.info" then: field: description function: truthy info-version-required: description: Info version must be present severity: error given: "$.info" then: field: version function: truthy # OPENAPI VERSION openapi-version-3: description: Must use OpenAPI 3.x severity: error given: "$" then: field: openapi function: pattern functionOptions: match: "^3\\." # SERVERS servers-required: description: Servers must be defined severity: error given: "$" then: field: servers function: truthy servers-https-only: description: Server URLs must use HTTPS severity: error given: "$.servers[*]" then: field: url function: pattern functionOptions: match: "^https://" # OPERATIONS 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 Security Hub" severity: warn given: "$.paths[*][get,post,put,patch,delete].summary" then: function: pattern functionOptions: match: "^Amazon Security Hub" operation-description-required: description: Every operation must have a description severity: warn given: "$.paths[*][get,post,put,patch,delete]" then: field: description function: truthy operation-id-required: description: Every operation must have an operationId severity: error given: "$.paths[*][get,post,put,patch,delete]" then: field: operationId function: truthy operation-tags-required: description: Every operation must have at least one tag severity: warn given: "$.paths[*][get,post,put,patch,delete]" then: field: tags function: truthy # PATHS paths-kebab-case: description: Path segments must use kebab-case severity: warn given: "$.paths" then: function: pattern functionOptions: match: "^(/[a-z0-9-]+)*(/\\{[a-z][a-zA-Z0-9]*\\})*$" # PARAMETERS parameter-description-required: description: Every parameter must have a description severity: warn given: "$.paths[*][get,post,put,patch,delete].parameters[*]" then: field: description function: truthy # RESPONSES response-success-required: description: Every operation must have a 200 response severity: error given: "$.paths[*][get,post,put,patch,delete].responses" then: function: schema functionOptions: schema: anyOf: - required: ['200'] - required: ['201'] - required: ['204'] response-description-required: description: Every response must have a description severity: warn given: "$.paths[*][get,post,put,patch,delete].responses[*]" then: field: description function: truthy # SCHEMAS schema-description-recommended: description: Top-level component schemas should have descriptions severity: info given: "$.components.schemas[*]" then: field: description function: truthy # SECURITY security-schemes-defined: description: Security schemes should be defined in components severity: warn given: "$" then: field: components.securitySchemes function: truthy # GENERAL QUALITY microcks-operation-present: description: Operations should have x-microcks-operation for mock support severity: info given: "$.paths[*][get,post,put,patch,delete]" then: field: x-microcks-operation function: truthy