rules: # INFO / METADATA info-title-required: description: OpenAPI info must have a title. severity: error given: "$.info" then: field: title function: truthy info-description-required: description: OpenAPI info must have a description with at least 20 characters. severity: warn given: "$.info" then: field: description function: minLength functionOptions: min: 20 info-version-required: description: OpenAPI info must have a version field. severity: error given: "$.info" then: field: version function: truthy # OPENAPI VERSION openapi-version-3: description: Specs must use OpenAPI 3.0.x. severity: error given: "$" then: field: openapi function: pattern functionOptions: match: "^3\\.0\\." # SERVERS servers-required: description: At least one server must be defined. severity: error given: "$" then: field: servers function: truthy servers-https-required: description: Server URLs must use HTTPS. severity: warn 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,head,options]" then: field: summary function: truthy operation-summary-amazon-prefix: description: Operation summaries should start with "Amazon Cognito". severity: warn given: "$.paths[*][get,post,put,patch,delete,head,options].summary" then: function: pattern functionOptions: match: "^Amazon Cognito" operation-description-required: description: Every operation must have a description. severity: warn given: "$.paths[*][get,post,put,patch,delete,head,options]" then: field: description function: truthy operation-id-required: description: Every operation must have an operationId. severity: error given: "$.paths[*][get,post,put,patch,delete,head,options]" then: field: operationId function: truthy operation-id-pascal-case: description: OperationIds should use PascalCase as per AWS convention. severity: warn given: "$.paths[*][get,post,put,patch,delete,head,options].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: warn given: "$.paths[*][get,post,put,patch,delete,head,options]" then: field: tags function: truthy # PARAMETERS parameter-description-required: description: Every parameter must have a description. severity: warn given: "$.paths[*][get,post,put,patch,delete,head,options].parameters[*]" then: field: description function: truthy parameter-schema-required: description: Every parameter must have a schema. severity: error given: "$.paths[*][get,post,put,patch,delete,head,options].parameters[*]" then: field: schema function: truthy # REQUEST BODIES request-body-json-content: description: Request bodies should use application/json content type. severity: warn given: "$.paths[*][post,put,patch].requestBody.content" then: field: application/json function: truthy # RESPONSES response-success-required: description: Every operation must define responses. severity: error given: "$.paths[*][get,post,put,patch,delete]" then: field: responses function: truthy 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 schemas should have a description. severity: info given: "$.components.schemas[*]" then: field: description function: truthy schema-type-defined: description: Schema objects should have a type defined. severity: warn given: "$.components.schemas[*]" then: field: type function: truthy # SECURITY security-schemes-defined: description: Security schemes must be defined in components. severity: error given: "$.components" then: field: securitySchemes function: truthy # HTTP METHOD CONVENTIONS get-no-request-body: description: GET operations should not have a request body. severity: error given: "$.paths[*].get" then: field: requestBody function: falsy # GENERAL QUALITY no-empty-descriptions: description: Descriptions must not be empty strings. severity: warn given: "$..description" then: function: truthy microcks-operation-extension: description: Operations should have x-microcks-operation for mock server compatibility. severity: info given: "$.paths[*][get,post,put,patch,delete]" then: field: x-microcks-operation function: truthy cognito-scopes-documented: description: OAuth scopes used by Cognito User Pools should be documented in security schemes. severity: info given: "$.components.securitySchemes[*]" then: field: description function: truthy