rules: # INFO / METADATA info-title-required: description: Info object must have a title. given: $.info severity: error then: field: title function: truthy info-description-required: description: Info object must have a description. given: $.info severity: warn then: field: description function: truthy info-version-required: description: Info object must have a version. given: $.info severity: error then: field: version function: truthy # OPENAPI VERSION openapi-version-3: description: OpenAPI version must be 3.x. given: $.openapi severity: error then: function: pattern functionOptions: match: "^3\\." # SERVERS servers-defined: description: Servers must be defined. given: $ severity: error then: field: servers function: truthy servers-https: description: Server URLs must use HTTPS. given: $.servers[*].url severity: warn then: function: pattern functionOptions: match: "^https://" # PATHS paths-kebab-case: description: Path segments should be kebab-case or templated. given: $.paths.*~ severity: warn then: function: pattern functionOptions: match: "^(/([a-z0-9_\\-]+|\\{[a-zA-Z0-9_]+\\}))*/?$" paths-no-trailing-slash: description: Paths should not end with a trailing slash. given: $.paths.*~ severity: warn then: function: pattern functionOptions: notMatch: ".+/$" # OPERATIONS operation-summary-required: description: Operations must have a summary. given: $.paths[*][get,post,put,patch,delete] severity: warn then: field: summary function: truthy operation-tags-required: description: Operations should have at least one tag. given: $.paths[*][get,post,put,patch,delete] severity: warn then: field: tags function: truthy # PARAMETERS parameter-snake-case: description: Parameter names should be snake_case. given: $.paths[*][*].parameters[?(@.in == 'query')].name severity: info then: function: pattern functionOptions: match: "^[a-z][a-z0-9_]*$" # RESPONSES response-success-required: description: Operations must define at least one 2xx response. given: $.paths[*][get,post,put,patch,delete].responses severity: error then: function: schema functionOptions: schema: type: object patternProperties: "^2[0-9][0-9]$": {} minProperties: 1 # SECURITY security-defined: description: Security schemes must be defined. given: $.components.securitySchemes severity: warn then: function: truthy