# ahasend — Spectral ruleset (strengthened) # Plain Spectral. Existing hand-authored rules preserved; measured rules added # from this provider's own OpenAPI conventions by strengthen_ruleset.py, # then self-validated against the spec. # # Provenance: # - servers-https-only: 100% of servers already https (error) # - servers-expected-domain: 2/2 servers on ahasend.com # - path-params-casing: snake @ 100% (n=60) # - query-params-casing: snake @ 100% (n=66) # - operationid-casing: camel @ 98% (n=44) # - schema-names-casing: pascal @ 100% (n=65) # - schema-properties-casing: snake @ 100% (n=366) # - security: global (root) — NOT emitting operation-security-required # - error-schema-defined: ErrorResponse # - operation-documents-400: 93% adherence # - operation-documents-401: 98% adherence # - operation-documents-403: 100% adherence # - operation-documents-500: 98% adherence # - pagination params observed: ['limit'] # - merge: kept 28 existing, added 10 measured, upgraded 0 # - added: servers-expected-domain, path-params-casing, query-params-casing, schema-names-casing, schema-properties-casing, error-schema-defined, operation-documents-400, operation-documents-401, operation-documents-403, operation-documents-500 extends: - spectral:oas rules: info-title-format: description: API title must start with "AhaSend" severity: warn given: $.info.title then: function: pattern functionOptions: match: ^AhaSend info-description-required: description: API must have a non-empty description severity: error given: $.info then: field: description function: truthy info-version-required: description: API must specify a version severity: error given: $.info then: field: version function: truthy info-contact-email: description: API contact email should be provided severity: warn given: $.info.contact then: field: email function: truthy openapi-version: description: Use OpenAPI 3.x severity: warn given: $ then: field: openapi function: truthy servers-defined: description: Servers array must be defined and non-empty severity: error given: $ then: field: servers function: truthy servers-https-only: description: Server URLs must use HTTPS severity: error given: $.servers[*].url then: function: pattern functionOptions: match: ^https:// paths-kebab-case: description: Path segments must use kebab-case severity: warn given: $.paths[*]~ then: function: pattern functionOptions: match: ^(/([a-z0-9{}-])+)*/?$ paths-no-trailing-slash: description: Paths must not end with a trailing slash severity: warn given: $.paths[*]~ then: function: pattern functionOptions: notMatch: /$ 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-summary-prefix: description: Operation summaries must start with "AhaSend" severity: warn given: $.paths[*][get,post,put,patch,delete].summary then: function: pattern functionOptions: match: ^AhaSend 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: operationId must use camelCase severity: warn given: $.paths[*][get,post,put,patch,delete].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 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 parameter-schema-required: description: All parameters must have a schema severity: error given: $.paths[*][get,post,put,patch,delete].parameters[*] then: field: schema function: truthy request-body-description: description: Request bodies should have a description severity: warn given: $.paths[*][post,put,patch].requestBody then: field: description function: truthy response-success-required: description: Operations must have a 2xx success response severity: error given: $.paths[*][get,post,put,patch,delete].responses then: function: schema functionOptions: schema: oneOf: - required: - '200' - required: - '201' - required: - '204' 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 schema-property-description: description: Top-level schema properties should have descriptions severity: info given: $.components.schemas[*].properties[*] then: field: description function: truthy schema-type-required: description: Schema properties should have a type defined severity: warn given: $.components.schemas[*].properties[*] then: field: type function: truthy security-schemes-defined: description: Security schemes must be defined severity: error given: $.components.securitySchemes then: function: truthy security-bearer-format: description: Bearer auth token format should be documented severity: info given: $.components.securitySchemes[*][?(@.scheme == 'bearer')] then: field: bearerFormat function: truthy get-no-request-body: description: GET operations must 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 no-empty-descriptions: description: Descriptions must not be empty strings severity: warn given: $..description then: function: truthy idempotency-key-documented: description: POST endpoints should document idempotency key header support severity: info given: $.paths[*].post.parameters[*] then: function: schema functionOptions: schema: properties: name: {} servers-expected-domain: description: Server URLs should be on the ahasend.com domain. severity: warn given: $.servers[*].url then: function: pattern functionOptions: match: ahasend\.com path-params-casing: description: Path parameters should be snake_case (the dominant convention in this API). severity: warn given: $.paths[*].parameters[?(@.in=='path')].name then: function: casing functionOptions: type: snake query-params-casing: description: Query parameters should be snake_case (the dominant convention in this API). severity: warn given: $.paths[*][get,post,put,patch,delete].parameters[?(@.in=='query')] then: field: name function: casing functionOptions: type: snake schema-names-casing: description: Component schema names should be PascalCase (the dominant convention in this API). severity: warn given: $.components.schemas then: field: '@key' function: pattern functionOptions: match: ^[A-Z][A-Za-z0-9]*$ schema-properties-casing: description: Schema properties should be snake_case (the dominant convention in this API). severity: warn given: $.components.schemas[*].properties then: field: '@key' function: casing functionOptions: type: snake error-schema-defined: description: A shared error schema (ErrorResponse) should be defined for error payloads. severity: warn given: $.components.schemas then: field: ErrorResponse function: truthy operation-documents-400: description: Operations should document a 400 response (documented on 93% of this API's operations). severity: warn given: $.paths[*][get,post,put,patch,delete].responses then: field: '400' function: truthy operation-documents-401: description: Operations should document a 401 response (documented on 98% of this API's operations). severity: warn given: $.paths[*][get,post,put,patch,delete].responses then: field: '401' function: truthy operation-documents-403: description: Operations should document a 403 response (documented on 100% of this API's operations). severity: warn given: $.paths[*][get,post,put,patch,delete].responses then: field: '403' function: truthy operation-documents-500: description: Operations should document a 500 response (documented on 98% of this API's operations). severity: warn given: $.paths[*][get,post,put,patch,delete].responses then: field: '500' function: truthy