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. severity: warn given: "$.info" then: field: description function: truthy 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 should 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]" then: field: summary function: truthy operation-summary-amazon-prefix: description: Operation summaries should start with Amazon Comprehend. severity: warn given: "$.paths[*][get,post,put,patch,delete].summary" then: function: pattern functionOptions: match: "^Amazon Comprehend" 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-id-pascal-case: description: OperationIds should use PascalCase as per AWS convention. 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: warn given: "$.paths[*][get,post,put,patch,delete]" 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].parameters[*]" then: field: description function: truthy # REQUEST BODIES request-body-json-content: description: Request bodies should use application/json. severity: warn given: "$.paths[*][post,put,patch].requestBody.content" then: field: application/json function: truthy # RESPONSES 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. severity: warn given: "$.components.schemas[*]" then: field: type function: truthy # SECURITY security-schemes-defined: description: Security schemes must be defined. severity: error given: "$.components" then: field: securitySchemes function: truthy # HTTP CONVENTIONS get-no-request-body: description: GET operations should not have a request body. severity: error given: "$.paths[*].get" then: field: requestBody function: falsy # COMPREHEND-SPECIFIC comprehend-language-code-documented: description: Language code parameters should be documented with valid ISO 639-1 codes. severity: info given: "$.components.schemas.LanguageCode" then: field: enum function: truthy comprehend-confidence-score-range: description: Confidence score properties should have minimum and maximum defined. severity: info given: "$.components.schemas[*].properties.Score" then: function: truthy # 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