rules: # INFO / METADATA info-title-required: description: API info must have a title severity: error given: $.info then: field: title function: truthy info-description-required: description: API info must have a description severity: warn given: $.info then: field: description function: truthy info-version-required: description: API info must have a version severity: error given: $.info then: field: version function: truthy info-contact-required: description: API info should have contact information severity: warn given: $.info then: field: contact function: truthy # OPENAPI VERSION openapi-version-3: description: All WildApricot specs must use OpenAPI 3.x severity: error 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-account-prefix: description: WildApricot paths should use /accounts/{accountId}/ prefix severity: info given: $.paths[*]~ then: function: pattern functionOptions: match: "^/(accounts|rpc)/" paths-no-trailing-slash: description: Paths must not end with a trailing slash severity: warn given: $.paths[*]~ then: function: pattern functionOptions: notMatch: "/$" # OPERATIONS operation-summary-required: description: All operations must have a summary severity: error given: $.paths[*][get,post,put,patch,delete,head,options] then: field: summary function: truthy operation-description-required: description: All operations should have a description severity: warn given: $.paths[*][get,post,put,patch,delete,head,options] then: field: description function: truthy operation-operation-id-required: description: All operations must have an operationId severity: error given: $.paths[*][get,post,put,patch,delete,head,options] then: field: operationId function: truthy operation-summary-wildapricot-prefix: description: Operation summaries should start with "WildApricot" severity: info given: $.paths[*][get,post,put,patch,delete,head,options].summary then: function: pattern functionOptions: match: "^WildApricot " operation-tags-required: description: All operations must have at least one tag severity: warn given: $.paths[*][get,post,put,patch,delete,head,options] then: field: tags function: truthy # TAGS tags-global-defined: description: Global tags array must be defined severity: warn given: $ then: field: tags function: truthy # PARAMETERS parameter-account-id-path: description: Path parameters named accountId should use path-level definition severity: info given: $.paths[*][get,post,put,patch,delete].parameters[?(@.name == 'accountId')] then: field: in function: pattern functionOptions: match: "^path$" parameter-description-required: description: All parameters must have a description severity: warn given: $.paths[*][get,post,put,patch,delete].parameters[*] then: field: description function: truthy # REQUEST BODIES request-body-content-required: description: Request bodies must define content severity: error given: $.paths[*][post,put,patch].requestBody then: field: content function: truthy # RESPONSES response-success-required: description: Every operation must define at least one 2xx response severity: error given: $.paths[*][get,post,put,patch,delete] then: field: responses function: truthy response-description-required: description: All responses must have a description severity: error given: $.paths[*][get,post,put,patch,delete].responses[*] then: field: description function: truthy # SCHEMAS 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 must be defined for OAuth2 severity: warn given: $.components then: field: securitySchemes function: truthy operation-security-defined: description: Operations should define security requirements severity: warn given: $.paths[*][get,post,put,patch,delete] 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-returns-2xx: description: POST operations should return 200 or 201 severity: warn given: $.paths[*].post then: field: responses function: truthy # GENERAL QUALITY no-empty-descriptions: description: Descriptions must not be empty strings severity: warn given: $..description then: function: pattern functionOptions: match: ".+"