rules: # INFO / METADATA info-title-required: description: Info must have a title severity: error given: $.info then: field: title function: truthy info-description-required: description: Info must have a description severity: warn given: $.info then: field: description function: truthy info-version-required: description: Info must have a version severity: error given: $.info then: field: version function: truthy info-contact-required: description: Info should have contact information severity: info given: $.info then: field: contact function: truthy # OPENAPI VERSION openapi-version-3: description: Must use OpenAPI 3.0.x severity: error given: $ then: field: openapi function: pattern functionOptions: match: "^3\\.0\\." # SERVERS servers-defined: description: Servers must be defined severity: error given: $ then: field: servers function: truthy servers-https-only: description: All 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: "/$" paths-b2-api-prefix: description: B2 Native API paths should use /b2api/v{version}/ prefix severity: warn given: $.paths then: function: pattern functionOptions: match: "^/b2api/" # 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-description-required: description: Every operation must 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: OperationIds 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: warn given: $.paths[*][get,post,put,patch,delete,head,options] then: field: tags function: truthy operation-summary-backblaze-prefix: description: Operation summaries should start with "Backblaze B2" severity: info given: $.paths[*][get,post,put,patch,delete,head,options].summary then: function: pattern functionOptions: match: "^Backblaze" # TAGS tags-global-defined: description: Global tags array should be defined severity: info given: $ then: field: tags function: truthy # PARAMETERS parameter-description-required: description: All parameters must have descriptions severity: warn given: $.paths[*][get,post,put,patch,delete,head,options].parameters[*] then: field: description function: truthy parameter-schema-required: description: All parameters must have a schema severity: error given: $.paths[*][get,post,put,patch,delete,head,options].parameters[*] then: field: schema function: truthy # REQUEST BODIES request-body-description: description: Request bodies should have descriptions severity: info given: $.paths[*][post,put,patch].requestBody then: field: description 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-description-required: description: Every response must have a description severity: error given: $.paths[*][get,post,put,patch,delete].responses[*] then: field: description function: truthy response-401-defined: description: Operations with auth should define 401 response severity: warn given: $.paths[*][post,get] then: field: responses.401 function: truthy # SCHEMAS — PROPERTY NAMING schema-type-defined: description: All schemas should have a type severity: warn given: $.components.schemas[*] then: field: type function: truthy schema-title-defined: description: All component schemas should have a title severity: info given: $.components.schemas[*] then: field: title function: truthy schema-description-defined: description: All component schemas should have a description severity: info given: $.components.schemas[*] then: field: description function: truthy # SECURITY security-schemes-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 post-b2-operations-have-request-body: description: POST operations should have a request body severity: warn given: $.paths[*].post then: field: requestBody function: truthy # GENERAL QUALITY no-empty-descriptions: description: Descriptions must not be empty strings severity: warn given: $..description then: function: truthy components-schemas-present: description: Spec should define reusable schemas in components severity: info given: $.components then: field: schemas function: truthy