rules: # INFO / METADATA info-title-required: description: API must have a title severity: error given: "$.info" then: field: title function: truthy info-description-required: description: API must have a description severity: warn given: "$.info" then: field: description function: truthy info-version-required: description: API must have a version severity: error given: "$.info" then: field: version function: truthy # OPENAPI VERSION openapi-version-3: description: API must use OpenAPI 3.x severity: error given: "$" then: field: openapi function: pattern functionOptions: match: "^3\\." # SERVERS servers-defined: description: Servers must be defined severity: error given: "$" then: field: servers function: truthy server-https: description: Server URLs should use HTTPS severity: warn given: "$.servers[*]" then: field: url function: pattern functionOptions: match: "^https://" # OPERATIONS operation-summary-required: description: Operations must have a summary severity: error given: "$.paths[*][get,post,put,patch,delete,options,head]" then: field: summary function: truthy operation-description-required: description: Operations must have a description severity: warn given: "$.paths[*][get,post,put,patch,delete,options,head]" then: field: description function: truthy operation-id-required: description: Operations must have an operationId severity: error given: "$.paths[*][get,post,put,patch,delete,options,head]" then: field: operationId function: truthy operation-id-camel-case: description: OperationId should use camelCase severity: warn given: "$.paths[*][get,post,put,patch,delete,options,head]" then: field: operationId function: pattern functionOptions: match: "^[a-z][a-zA-Z0-9]*$" operation-tags-required: description: Operations must have tags severity: warn given: "$.paths[*][get,post,put,patch,delete,options,head]" then: field: tags function: truthy # PARAMETERS parameter-description-required: description: Parameters must have descriptions severity: warn given: "$.paths[*][*].parameters[*]" then: field: description function: truthy # RESPONSES response-success-required: description: Operations must have a success response severity: error given: "$.paths[*][get,post,put,patch,delete]" then: field: responses function: schema functionOptions: schema: type: object anyOf: - required: ['200'] - required: ['201'] - required: ['202'] - required: ['204'] response-description-required: description: Responses must have descriptions severity: warn given: "$.paths[*][*].responses[*]" then: field: description function: truthy # SCHEMAS schema-type-defined: description: Schema properties should have types severity: warn given: "$.components.schemas[*].properties[*]" then: field: type function: truthy schema-description-required: description: Top-level schemas should have descriptions severity: info given: "$.components.schemas[*]" then: field: description function: truthy # SECURITY security-schemes-defined: description: Security schemes should be defined 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