rules: # INFO / METADATA info-title-prefix: description: API title should start with "Amnic". severity: warn given: $.info.title then: function: pattern functionOptions: match: '^Amnic' info-description-required: description: API info must have a description of at least 20 characters. severity: error given: $.info then: field: description function: truthy info-version-required: description: API info must define a version. 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 # OPENAPI VERSION openapi-version-3: description: OpenAPI version must be 3.0.x. severity: error given: $.openapi then: function: pattern functionOptions: match: '^3\.0\.' # SERVERS servers-defined: description: At least one server must be defined. severity: error given: $ then: field: servers function: truthy servers-https: description: Server URLs must use HTTPS. severity: error given: $.servers[*].url then: function: pattern functionOptions: match: '^https://' servers-description: description: Each server should have a description. severity: warn given: $.servers[*] then: field: description function: truthy # PATHS - NAMING CONVENTIONS paths-kebab-case: description: Path segments should use kebab-case (lowercase with hyphens). severity: warn given: $.paths[*]~ then: function: pattern functionOptions: match: '^(/[a-z0-9{}-]+)+$' paths-no-trailing-slash: description: Paths must not have trailing slashes. severity: error given: $.paths[*]~ then: function: pattern functionOptions: notMatch: '/$' # 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-prefix: description: Operation summaries should start with "Amnic". severity: warn given: $.paths[*][get,post,put,patch,delete,head,options].summary then: function: pattern functionOptions: match: '^Amnic' 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].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: 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 tags-description: description: Global tags should have descriptions. severity: warn given: $.tags[*] then: field: description function: truthy # PARAMETERS parameter-description-required: description: Every parameter must have a description. severity: error given: $.paths[*][*].parameters[*] then: field: description function: truthy parameter-snake-case: description: Query and path parameter names should use snake_case or kebab-case. severity: warn given: $.paths[*][*].parameters[?(@.in == 'query')].name then: function: pattern functionOptions: match: '^[a-z][a-z0-9_]*$' # REQUEST BODIES request-body-content-type: 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 have at least one 2xx response. severity: error given: $.paths[*][get,post,put,patch,delete] then: field: responses function: truthy response-401-required: description: Operations with security should document a 401 response. severity: warn given: $.paths[*][get,post,put,patch,delete].responses then: field: '401' function: truthy response-description-required: description: Every response must have a description. severity: error given: $.paths[*][*].responses[*] then: field: description function: truthy # SCHEMAS - PROPERTY NAMING schema-description-required: description: Top-level schemas should have a description. severity: warn given: $.components.schemas[*] then: field: description function: truthy schema-property-snake-case: description: Schema property names should use snake_case. severity: warn given: $.components.schemas[*].properties[*]~ then: function: pattern functionOptions: match: '^[a-z][a-z0-9_]*$' # SECURITY security-scheme-defined: description: Security schemes must be defined in components. severity: error given: $.components then: field: securitySchemes function: truthy security-global-defined: description: Global security should 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 # GENERAL QUALITY no-empty-descriptions: description: Descriptions must not be empty strings. severity: error given: $..description then: function: pattern functionOptions: match: '.+' examples-encouraged: description: Operations should include examples for better documentation. severity: info given: $.paths[*][*].responses[*].content[*] then: field: examples function: truthy