extends: spectral:oas rules: # INFO / METADATA info-title-matches-provider: description: API title should include the provider name (Amazon DocumentDB). severity: warn given: "$.info" then: field: title function: pattern functionOptions: match: "^Amazon DocumentDB" info-description-required: description: API info must include a description. severity: error given: "$.info" then: field: description function: truthy info-version-required: description: API version must be defined. severity: error given: "$.info" then: field: version function: truthy info-contact-required: description: API info should include contact information. severity: warn given: "$.info" then: field: contact function: truthy info-license-required: description: API info should include license information. severity: warn given: "$.info" then: field: license function: truthy # OPENAPI VERSION openapi-version-3: description: OpenAPI specification should use version 3.x. severity: error given: "$" then: field: openapi function: pattern functionOptions: match: "^3\\." # SERVERS servers-defined: description: At least one server must be defined. severity: error given: "$" then: field: servers function: truthy servers-https: description: Server URLs should use HTTPS. severity: warn given: "$.servers[*]" then: field: url function: pattern functionOptions: match: "^https://" servers-description: description: Each server should have a description. severity: info given: "$.servers[*]" then: field: description function: truthy # 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-provider-prefix: description: Operation summary should begin with the provider name (Amazon DocumentDB). severity: warn given: "$.paths[*][get,post,put,patch,delete,head,options]" then: field: summary function: pattern functionOptions: match: "^Amazon DocumentDB" operation-description-required: description: Every operation should 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-camel-case: description: OperationId should use camelCase. severity: warn given: "$.paths[*][get,post,put,patch,delete,head,options]" then: field: operationId function: pattern functionOptions: match: "^[a-z][a-zA-Z0-9]*$" operation-tags-required: description: Every operation must have at least one tag. severity: error given: "$.paths[*][get,post,put,patch,delete,head,options]" then: field: tags function: truthy # TAGS tags-global-defined: description: Global tags array should be defined. severity: warn given: "$" then: field: tags function: truthy tag-description-required: description: Each global tag should have a description. severity: info given: "$.tags[*]" then: field: description function: truthy # PARAMETERS parameter-description-required: description: All parameters must have a description. severity: warn given: "$..parameters[*]" then: field: description function: truthy parameter-schema-required: description: All parameters must have a schema. severity: error given: "$..parameters[*]" then: field: schema function: truthy # RESPONSES response-success-required: description: Every operation must define at least one 2xx response. severity: error given: "$.paths[*][get,post,put,patch,delete]" then: field: responses function: schema functionOptions: schema: type: object minProperties: 1 response-description-required: description: Every response must have a description. severity: error given: "$.paths[*][*].responses[*]" then: field: description function: truthy # SCHEMAS schema-property-description: description: Schema properties should have descriptions. severity: info given: "$.components.schemas[*].properties[*]" then: field: description function: truthy schema-type-defined: description: Schemas should define a type. severity: warn given: "$.components.schemas[*]" then: field: type function: truthy # SECURITY security-schemes-defined: description: Security schemes should be defined in components. severity: warn 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 delete-no-request-body: description: DELETE operations should not have a request body. severity: warn given: "$.paths[*].delete" then: field: requestBody function: falsy # GENERAL QUALITY no-empty-descriptions: description: Descriptions should not be empty strings. severity: warn given: "$..description" then: function: pattern functionOptions: match: ".+" examples-encouraged: description: Operations should include examples for better documentation. severity: info given: "$.paths[*][get,post,put,patch,delete]" then: field: responses function: truthy