rules: # INFO / METADATA info-title-required: description: Info object must have a title severity: error given: $.info then: field: title function: truthy info-description-required: description: Info object must have a description severity: warn 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 # OPENAPI VERSION openapi-version-3: description: OpenAPI version should be 3.x severity: warn given: $ then: field: openapi function: pattern functionOptions: match: "^3\\." # SERVERS servers-defined: description: Servers array 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://" # PATHS — NAMING CONVENTIONS paths-no-trailing-slash: description: Paths must not have trailing slashes severity: warn given: $.paths[*]~ then: function: pattern functionOptions: notMatch: "/$" # OPERATIONS operation-summary-required: description: Operations must have a summary severity: error given: $.paths[*][get,post,put,delete,patch] then: field: summary function: truthy operation-description-required: description: Operations must have a description severity: warn given: $.paths[*][get,post,put,delete,patch] then: field: description function: truthy operation-operationId-required: description: Operations must have an operationId severity: error given: $.paths[*][get,post,put,delete,patch] then: field: operationId function: truthy operation-tags-required: description: Operations must have at least one tag severity: warn given: $.paths[*][get,post,put,delete,patch] then: field: tags function: truthy operation-summary-provider-prefix: description: Operation summaries should start with 'TheCocktailDB' severity: info given: $.paths[*][get,post,put,delete,patch].summary then: function: pattern functionOptions: match: "^TheCocktailDB " # PARAMETERS parameter-description-required: description: Parameters must have descriptions severity: warn given: $.paths[*][get,post,put,delete,patch].parameters[*] then: field: description function: truthy # RESPONSES response-success-required: description: Operations must have at least one success response severity: error given: $.paths[*][get,post,put,delete,patch].responses then: function: schema functionOptions: schema: type: object minProperties: 1 response-description-required: description: Response objects must have a description severity: warn given: $.paths[*][get,post,put,delete,patch].responses[*] then: field: description function: truthy # SCHEMAS schema-type-defined: description: Schema objects should have a type severity: warn given: $.components.schemas[*] then: field: type function: truthy # HTTP METHODS 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 severity: warn given: $..description then: function: pattern functionOptions: match: ".+" operation-examples-encouraged: description: Operations should have examples severity: info given: $.paths[*][get,post,put,delete,patch].responses[*].content[*] then: field: examples function: defined