Wolfram|Alpha · API Governance Rules

Wolfram|Alpha API Rules

Spectral linting rules defining API design standards and conventions for Wolfram|Alpha.

33 Rules error 10 warn 18 info 5
View Rules File View on GitHub

Rule Categories

delete get info microcks no openapi operation parameter paths query response schema security servers tag

Rules

error
info-title-required
API title must be present and start with "Wolfram|Alpha".
$.info
error
info-description-required
API description must be present and at least 50 characters.
$.info
error
info-version-required
API version must be specified.
$.info
warn
info-contact-required
Contact information must be present.
$.info
warn
openapi-version
OpenAPI version must be 3.1.0.
$
error
servers-required
At least one server must be defined.
$
error
servers-https
All server URLs must use HTTPS.
$.servers[*]
warn
paths-no-trailing-slash
Paths must not have trailing slashes.
$.paths[*]~
error
paths-query-params-not-in-path
Query parameters must not be embedded in path strings.
$.paths[*]~
error
operation-operationid-required
Every operation must have an operationId.
$.paths[*][get,post,put,patch,delete,head,options]
warn
operation-operationid-camelcase
operationId must use camelCase.
$.paths[*][get,post,put,patch,delete,head,options].operationId
error
operation-summary-required
Every operation must have a summary.
$.paths[*][get,post,put,patch,delete,head,options]
warn
operation-summary-wolfram-prefix
Operation summaries must start with "Wolfram|Alpha ".
$.paths[*][get,post,put,patch,delete,head,options].summary
warn
operation-description-required
Every operation must have a description.
$.paths[*][get,post,put,patch,delete,head,options]
warn
operation-tags-required
Every operation must have at least one tag.
$.paths[*][get,post,put,patch,delete,head,options]
warn
parameter-description-required
All parameters must have descriptions.
$.paths[*][get,post,put,patch,delete][*].parameters[*]
info
parameter-appid-required-description
The appid parameter description must mention Wolfram|Alpha AppID.
$.paths[*][get].parameters[?(@.name == 'appid')]
error
response-success-required
Operations must define at least a 200 success response.
$.paths[*][get,post,put,patch,delete].responses
info
response-error-400-defined
Operations should define a 400 error response.
$.paths[*][get,post].responses
info
response-error-403-defined
Operations should define a 403 error response for auth-protected APIs.
$.paths[*][get,post].responses
warn
tag-description-required
Global tags must have descriptions.
$.tags[*]
warn
security-schemes-defined
Security schemes must be defined in components.
$.components.securitySchemes
error
get-no-request-body
GET operations must not have request bodies.
$.paths[*].get
warn
delete-no-request-body
DELETE operations should not have request bodies.
$.paths[*].delete
info
operation-examples-encouraged
Operations should provide examples for documentation and mocking.
$.paths[*][get,post,put,patch,delete].responses[*].content[*]
info
microcks-operation-extension
Operations should include x-microcks-operation for mock server compatibility.
$.paths[*][get,post,put,patch,delete]
warn
servers-expected-domain
Server URLs should be on the wolframalpha.com domain.
$.servers[*].url
warn
query-params-casing
Query parameters should be snake_case (the dominant convention in this API).
$.paths[*][get,post,put,patch,delete].parameters[?(@.in=='query')]
warn
schema-names-casing
Component schema names should be PascalCase (the dominant convention in this API).
$.components.schemas
warn
schema-properties-casing
Schema properties should be snake_case (the dominant convention in this API).
$.components.schemas[*].properties
warn
operation-documents-400
Operations should document a 400 response (documented on 100% of this API's operations).
$.paths[*][get,post,put,patch,delete].responses
warn
operation-documents-403
Operations should document a 403 response (documented on 100% of this API's operations).
$.paths[*][get,post,put,patch,delete].responses
warn
no-empty-descriptions
Descriptions must not be empty strings.
$..description

Spectral Ruleset

Raw ↑
# wolfram-alpha — 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: 5/5 servers on wolframalpha.com
#   - query-params-casing: snake @ 100% (n=47)
#   - operationid-casing: camel @ 100% (n=5)
#   - schema-names-casing: pascal @ 100% (n=4)
#   - schema-properties-casing: snake @ 93% (n=14)
#   - security: global (root) — NOT emitting operation-security-required
#   - operation-documents-400: 100% adherence
#   - operation-documents-403: 100% adherence
#   - merge: kept 26 existing, added 7 measured, upgraded 0
#   - added: servers-expected-domain, query-params-casing, schema-names-casing, schema-properties-casing, operation-documents-400, operation-documents-403, no-empty-descriptions
extends:
  - spectral:oas
rules:
  info-title-required:
    description: API title must be present and start with "Wolfram|Alpha".
    message: info.title must be present and start with 'Wolfram|Alpha'.
    severity: error
    given: $.info
    then:
    - field: title
      function: truthy
    - field: title
      function: pattern
      functionOptions:
        match: ^Wolfram\|Alpha
  info-description-required:
    description: API description must be present and at least 50 characters.
    severity: error
    given: $.info
    then:
      field: description
      function: minLength
      functionOptions:
        value: 50
  info-version-required:
    description: API version must be specified.
    severity: error
    given: $.info
    then:
      field: version
      function: truthy
  info-contact-required:
    description: Contact information must be present.
    severity: warn
    given: $.info
    then:
      field: contact
      function: truthy
  openapi-version:
    description: OpenAPI version must be 3.1.0.
    severity: warn
    given: $
    then:
      field: openapi
      function: pattern
      functionOptions:
        match: ^3\.1\.
  servers-required:
    description: At least one server must be defined.
    severity: error
    given: $
    then:
      field: servers
      function: truthy
  servers-https:
    description: All server URLs must use HTTPS.
    severity: error
    given: $.servers[*]
    then:
      field: url
      function: pattern
      functionOptions:
        match: ^https://
  paths-no-trailing-slash:
    description: Paths must not have trailing slashes.
    severity: warn
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        notMatch: /$
  paths-query-params-not-in-path:
    description: Query parameters must not be embedded in path strings.
    severity: error
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        notMatch: \?
  operation-operationid-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-operationid-camelcase:
    description: operationId must 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-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-wolfram-prefix:
    description: Operation summaries must start with "Wolfram|Alpha ".
    message: Operation summary must start with 'Wolfram|Alpha '.
    severity: warn
    given: $.paths[*][get,post,put,patch,delete,head,options].summary
    then:
      function: pattern
      functionOptions:
        match: '^Wolfram\|Alpha '
  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-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 descriptions.
    severity: warn
    given: $.paths[*][get,post,put,patch,delete][*].parameters[*]
    then:
      field: description
      function: truthy
  parameter-appid-required-description:
    description: The appid parameter description must mention Wolfram|Alpha AppID.
    severity: info
    given: $.paths[*][get].parameters[?(@.name == 'appid')]
    then:
      field: description
      function: truthy
  response-success-required:
    description: Operations must define at least a 200 success response.
    severity: error
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      function: schema
      functionOptions:
        schema:
          anyOf:
          - required:
            - '200'
          - required:
            - '201'
  response-error-400-defined:
    description: Operations should define a 400 error response.
    severity: info
    given: $.paths[*][get,post].responses
    then:
      function: schema
      functionOptions:
        schema:
          required:
          - '400'
  response-error-403-defined:
    description: Operations should define a 403 error response for auth-protected APIs.
    severity: info
    given: $.paths[*][get,post].responses
    then:
      function: schema
      functionOptions:
        schema:
          required:
          - '403'
  tag-description-required:
    description: Global tags must have descriptions.
    severity: warn
    given: $.tags[*]
    then:
      field: description
      function: truthy
  security-schemes-defined:
    description: Security schemes must be defined in components.
    severity: warn
    given: $.components.securitySchemes
    then:
      function: truthy
  get-no-request-body:
    description: GET operations must not have request bodies.
    severity: error
    given: $.paths[*].get
    then:
      field: requestBody
      function: falsy
  delete-no-request-body:
    description: DELETE operations should not have request bodies.
    severity: warn
    given: $.paths[*].delete
    then:
      field: requestBody
      function: falsy
  operation-examples-encouraged:
    description: Operations should provide examples for documentation and mocking.
    severity: info
    given: $.paths[*][get,post,put,patch,delete].responses[*].content[*]
    then:
      function: schema
      functionOptions:
        schema:
          anyOf:
          - required:
            - example
          - required:
            - examples
  microcks-operation-extension:
    description: Operations should include x-microcks-operation for mock server compatibility.
    severity: info
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: x-microcks-operation
      function: truthy
  servers-expected-domain:
    description: Server URLs should be on the wolframalpha.com domain.
    severity: warn
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: wolframalpha\.com
  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: casing
      functionOptions:
        type: pascal
  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
  operation-documents-400:
    description: Operations should document a 400 response (documented on 100% of this API's operations).
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      field: '400'
      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
  no-empty-descriptions:
    description: Descriptions must not be empty strings.
    severity: warn
    given: $..description
    then:
      function: truthy