Alchemy · API Governance Rules

Alchemy API Rules

Spectral linting rules defining API design standards and conventions for Alchemy.

37 Rules error 13 warn 19 info 5
View Rules File View on GitHub

Rule Categories

error examples http info no openapi operation parameter paths request response schema security servers tags

Rules

warn
info-title-pattern
API title must start with "Alchemy" to follow provider naming convention.
$.info.title
error
info-description-required
API info must have a description.
$.info
error
info-version-required
API info must declare a version.
$.info
warn
info-contact-required
API info should include contact information.
$.info
error
openapi-version-3
Specs must use OpenAPI 3.0.x.
$.openapi
error
servers-defined
At least one server must be defined.
$
error
servers-https-only
All server URLs must use HTTPS.
$.servers[*].url
warn
servers-description-required
Each server must have a description.
$.servers[*]
warn
paths-no-trailing-slash
Paths must not end with a trailing slash.
$.paths[*]~
error
paths-no-query-strings
Paths must not contain query strings.
$.paths[*]~
error
operation-summary-required
Every operation must have a summary.
$.paths[*][get,post,put,patch,delete,options,head]
warn
operation-summary-title-case
Operation summaries must start with "Alchemy" and use Title Case.
$.paths[*][get,post,put,patch,delete].summary
warn
operation-description-required
Every operation must have a description.
$.paths[*][get,post,put,patch,delete,options,head]
error
operation-id-required
Every operation must have an operationId.
$.paths[*][get,post,put,patch,delete,options,head]
warn
operation-id-camel-case
operationId must use camelCase.
$.paths[*][get,post,put,patch,delete].operationId
warn
operation-tags-required
Every operation must have at least one tag.
$.paths[*][get,post,put,patch,delete,options,head]
warn
tags-global-defined
Global tags array must be defined.
$
warn
tags-description-required
Each global tag should have a description.
$.tags[*]
warn
parameter-description-required
All parameters must have a description.
$.paths[*][get,post,put,patch,delete].parameters[*]
info
request-body-json
Request bodies should use application/json content type.
$.paths[*][post,put,patch].requestBody.content
info
request-body-description
Request bodies should have a description.
$.paths[*][post,put,patch].requestBody
error
response-success-required
Every operation must define at least one 2xx response.
$.paths[*][get,post,put,patch,delete].responses
error
response-description-required
Every response must have a description.
$.paths[*][get,post,put,patch,delete].responses[*]
warn
response-401-for-secured
Operations with security should define a 401 response.
$.paths[*][get,post,put,patch,delete][?(@.security)]
warn
schema-description-on-top-level
Top-level component schemas should have a description.
$.components.schemas[*]
info
schema-type-defined
Schemas should define a type.
$.components.schemas[*]
error
security-schemes-defined
Security schemes must be defined in components.
$.components
warn
security-scheme-description
Security schemes should have a description.
$.components.securitySchemes[*]
error
http-get-no-body
GET operations must not have a request body.
$.paths[*].get
warn
http-delete-no-body
DELETE operations should not have a request body.
$.paths[*].delete
error
no-empty-descriptions
Descriptions must not be empty strings.
$..description
info
examples-encouraged
Operations should include request/response examples.
$.paths[*][post,get].responses[*].content[*]
warn
servers-expected-domain
Server URLs should be on the alchemy.com domain.
$.servers[*].url
warn
schema-names-casing
Component schema names should be PascalCase (the dominant convention in this API).
$.components.schemas
info
schema-properties-casing
Schema properties should be snake_case (the dominant convention in this API).
$.components.schemas[*].properties
warn
operation-security-required
Every operation should declare its security requirements.
$.paths[*][get,post,put,patch,delete]
warn
error-schema-defined
A shared error schema (ErrorResponse) should be defined for error payloads.
$.components.schemas

Spectral Ruleset

Raw ↑
# alchemy — 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: 6/6 servers on alchemy.com
#   - operationid-casing: camel @ 100% (n=7)
#   - schema-names-casing: pascal @ 100% (n=20)
#   - schema-properties-casing: snake @ 75% (n=68)
#   - operation-security-required: 7/7 ops declare per-op security
#   - error-schema-defined: ErrorResponse
#   - merge: kept 32 existing, added 5 measured, upgraded 0
#   - added: servers-expected-domain, schema-names-casing, schema-properties-casing, operation-security-required, error-schema-defined
extends:
  - spectral:oas
rules:
  info-title-pattern:
    description: API title must start with "Alchemy" to follow provider naming convention.
    message: 'Info title must start with ''Alchemy''. Found: {{value}}'
    severity: warn
    given: $.info.title
    then:
      function: pattern
      functionOptions:
        match: '^Alchemy '
  info-description-required:
    description: API info must have a description.
    severity: error
    given: $.info
    then:
      field: description
      function: truthy
  info-version-required:
    description: API info must declare a version.
    severity: error
    given: $.info
    then:
      field: version
      function: truthy
  info-contact-required:
    description: API info should include contact information.
    severity: warn
    given: $.info
    then:
      field: contact
      function: truthy
  openapi-version-3:
    description: Specs must use OpenAPI 3.0.x.
    message: 'OpenAPI version must be 3.0.x. Found: {{value}}'
    severity: error
    given: $.openapi
    then:
      function: pattern
      functionOptions:
        match: ^3\.0\.
  servers-defined:
    description: At least one server must be defined.
    severity: error
    given: $
    then:
      field: servers
      function: truthy
  servers-https-only:
    description: All server URLs must use HTTPS.
    message: 'Server URL must use HTTPS. Found: {{value}}'
    severity: error
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: ^https://
  servers-description-required:
    description: Each server must have a description.
    severity: warn
    given: $.servers[*]
    then:
      field: description
      function: truthy
  paths-no-trailing-slash:
    description: Paths must not end with a trailing slash.
    message: 'Path must not end with a trailing slash. Found: {{path}}'
    severity: warn
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        notMatch: /$
  paths-no-query-strings:
    description: Paths must not contain query strings.
    severity: error
    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,options,head]
    then:
      field: summary
      function: truthy
  operation-summary-title-case:
    description: Operation summaries must start with "Alchemy" and use Title Case.
    message: 'Summary should start with ''Alchemy''. Found: {{value}}'
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].summary
    then:
      function: pattern
      functionOptions:
        match: '^Alchemy '
  operation-description-required:
    description: Every operation must have a description.
    severity: warn
    given: $.paths[*][get,post,put,patch,delete,options,head]
    then:
      field: description
      function: truthy
  operation-id-required:
    description: Every operation must have an operationId.
    severity: error
    given: $.paths[*][get,post,put,patch,delete,options,head]
    then:
      field: operationId
      function: truthy
  operation-id-camel-case:
    description: operationId must use camelCase.
    message: 'operationId must be camelCase. Found: {{value}}'
    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,options,head]
    then:
      field: tags
      function: truthy
  tags-global-defined:
    description: Global tags array must be defined.
    severity: warn
    given: $
    then:
      field: tags
      function: truthy
  tags-description-required:
    description: Each global tag should have a description.
    severity: warn
    given: $.tags[*]
    then:
      field: description
      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
  request-body-json:
    description: Request bodies should use application/json content type.
    severity: info
    given: $.paths[*][post,put,patch].requestBody.content
    then:
      function: truthy
  request-body-description:
    description: Request bodies should have a description.
    severity: info
    given: $.paths[*][post,put,patch].requestBody
    then:
      field: description
      function: defined
  response-success-required:
    description: Every operation must define at least one 2xx response.
    severity: error
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          minProperties: 1
  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-for-secured:
    description: Operations with security should define a 401 response.
    severity: warn
    given: $.paths[*][get,post,put,patch,delete][?(@.security)]
    then:
      field: responses
      function: defined
  schema-description-on-top-level:
    description: Top-level component schemas should have a description.
    severity: warn
    given: $.components.schemas[*]
    then:
      field: description
      function: truthy
  schema-type-defined:
    description: Schemas should define a type.
    severity: info
    given: $.components.schemas[*]
    then:
      field: type
      function: defined
  security-schemes-defined:
    description: Security schemes must be defined in components.
    severity: error
    given: $.components
    then:
      field: securitySchemes
      function: truthy
  security-scheme-description:
    description: Security schemes should have a description.
    severity: warn
    given: $.components.securitySchemes[*]
    then:
      field: description
      function: truthy
  http-get-no-body:
    description: GET operations must not have a request body.
    severity: error
    given: $.paths[*].get
    then:
      field: requestBody
      function: falsy
  http-delete-no-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.
    message: Description must not be an empty string.
    severity: error
    given: $..description
    then:
      function: truthy
  examples-encouraged:
    description: Operations should include request/response examples.
    severity: info
    given: $.paths[*][post,get].responses[*].content[*]
    then:
      field: examples
      function: defined
  servers-expected-domain:
    description: Server URLs should be on the alchemy.com domain.
    severity: warn
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: alchemy\.com
  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: info
    given: $.components.schemas[*].properties
    then:
      field: '@key'
      function: casing
      functionOptions:
        type: snake
  operation-security-required:
    description: Every operation should declare its security requirements.
    severity: warn
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: security
      function: truthy
  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