rules: # INFO / METADATA info-title-format: message: API title should start with "AccuWeather" severity: warn given: "$.info.title" then: function: pattern functionOptions: match: "^AccuWeather" info-description-required: message: API info must have a non-empty description severity: error given: "$.info" then: field: description function: truthy info-version-required: message: API info must include a version severity: error given: "$.info" then: field: version function: truthy # OPENAPI VERSION openapi-version-3: message: Must use OpenAPI 3.x severity: error given: "$" then: field: openapi function: pattern functionOptions: match: "^3\\." # SERVERS servers-defined: message: At least one server must be defined severity: error given: "$" then: field: servers function: truthy servers-https-only: message: All server URLs must use HTTPS severity: error given: "$.servers[*].url" then: function: pattern functionOptions: match: "^https://" # PATHS — NAMING CONVENTIONS paths-kebab-case: message: Path segments should use kebab-case severity: warn given: "$.paths[*]~" then: function: pattern functionOptions: match: "^(/[a-z0-9{}-]+)+$" paths-no-trailing-slash: message: Paths should not have trailing slashes severity: warn given: "$.paths[*]~" then: function: pattern functionOptions: notMatch: "/$" # OPERATIONS operation-summary-required: message: All operations must have a summary severity: error given: "$.paths[*][get,post,put,patch,delete]" then: field: summary function: truthy operation-summary-starts-with-accuweather: message: Operation summaries should start with "AccuWeather" severity: warn given: "$.paths[*][get,post,put,patch,delete].summary" then: function: pattern functionOptions: match: "^AccuWeather" operation-description-required: message: All operations should have a description severity: warn given: "$.paths[*][get,post,put,patch,delete]" then: field: description function: truthy operation-tags-required: message: All operations must have at least one tag severity: warn given: "$.paths[*][get,post,put,patch,delete]" then: field: tags function: truthy operation-id-required: message: All operations must have an operationId severity: error given: "$.paths[*][get,post,put,patch,delete]" then: field: operationId function: truthy # PARAMETERS parameter-description-required: message: All parameters must have a description severity: warn given: "$.paths[*][*].parameters[*]" then: field: description function: truthy parameter-schema-required: message: All parameters must have a schema severity: error given: "$.paths[*][*].parameters[*]" then: field: schema function: truthy # RESPONSES response-success-required: message: All operations must have at least one 2xx response severity: error given: "$.paths[*][get,post,put,patch,delete].responses" then: function: schema functionOptions: schema: type: object anyOf: - required: ['200'] - required: ['201'] - required: ['204'] response-description-required: message: All responses must have a description severity: error given: "$.paths[*][*].responses[*]" then: field: description function: truthy response-error-401: message: Protected operations should include a 401 response severity: info given: "$.paths[*][get,post,put,patch,delete].responses" then: function: schema functionOptions: schema: type: object required: ['401'] # SCHEMAS — PROPERTY NAMING schema-properties-described: message: Schema properties should have descriptions severity: info given: "$.components.schemas[*].properties[*]" then: field: description function: truthy schema-type-defined: message: All schema properties should have a type defined severity: warn given: "$.components.schemas[*].properties[*]" then: field: type function: truthy # SECURITY security-schemes-defined: message: Security schemes should be defined in components severity: warn given: "$.components" then: field: securitySchemes function: truthy # HTTP METHOD CONVENTIONS get-no-request-body: message: GET operations must not have a request body severity: error given: "$.paths[*].get" then: field: requestBody function: falsy delete-no-request-body: message: DELETE operations should not have a request body severity: warn given: "$.paths[*].delete" then: field: requestBody function: falsy # GENERAL QUALITY operation-examples-encouraged: message: Operations should include examples for mock server compatibility severity: info given: "$.paths[*][get,post,put,patch,delete].responses[*].content[*]" then: function: schema functionOptions: schema: anyOf: - required: ['example'] - required: ['examples']