Edamam · API Governance Rules

Edamam API Rules

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

44 Rules error 8 warn 20 info 16
View Rules File View on GitHub

Rule Categories

error get info no openapi operation parameter paths post query request response schema security servers tag tags

Rules

error
info-title-required
The API must have a title.
$.info
warn
info-title-edamam-prefix
API title should start with "Edamam".
$.info.title
warn
info-description-required
The API must have a meaningful description.
$.info
info
info-description-min-length
The API description should be at least 40 characters.
$.info.description
error
info-version-required
The API must declare a version.
$.info
info
info-contact-required
The API should declare contact information.
$.info
warn
openapi-version-3-1
Edamam specs target OpenAPI 3.1.x.
$.openapi
error
servers-defined
At least one server must be defined.
$.servers
error
servers-https-only
Servers must use HTTPS.
$.servers[*].url
info
servers-edamam-host
Production server should be api.edamam.com.
$.servers[*].url
info
servers-description
Each server should have a description.
$.servers[*]
warn
paths-no-trailing-slash
Paths must not end with a trailing slash.
$.paths[*]~
warn
paths-kebab-case
Path segments should be lowercase kebab-case (allowing version tokens like v2 and {param} placeholders).
$.paths[*]~
error
paths-no-query-string
Path keys must not contain query strings.
$.paths[*]~
error
operation-operationId-required
Every operation must declare an operationId.
$.paths[*][get,post,put,patch,delete]
warn
operation-operationId-camelcase
operationId should be camelCase (e.g. searchRecipes, analyzeIngredient).
$.paths[*][get,post,put,patch,delete].operationId
warn
operation-summary-required
Every operation must have a summary.
$.paths[*][get,post,put,patch,delete]
warn
operation-summary-edamam-prefix
Operation summaries should be prefixed with "Edamam".
$.paths[*][get,post,put,patch,delete].summary
info
operation-description-required
Every operation should have a description.
$.paths[*][get,post,put,patch,delete]
warn
operation-tags-required
Every operation must be tagged.
$.paths[*][get,post,put,patch,delete]
info
tags-global-defined
A global tags array should be defined.
$
info
tag-description-required
Each global tag should have a description.
$.tags[*]
warn
tag-title-case
Tag names should be Title Case (e.g. "Recipe Search", "Food Database").
$.tags[*].name
warn
parameter-description-required
Every parameter should have a description.
$.paths[*][*].parameters[*]
warn
parameter-schema-type
Every parameter schema must declare a type.
$.paths[*][*].parameters[*].schema
info
parameter-example-encouraged
Parameters should provide an example value.
$.paths[*][*].parameters[*]
warn
request-body-json
Request bodies should offer application/json content.
$.paths[*][post,put,patch].requestBody.content
error
response-2xx-required
Every operation must define at least one 2xx response.
$.paths[*][get,post,put,patch,delete].responses
info
response-401-defined
Authenticated operations should document a 401 response.
$.paths[*][get,post,put,patch,delete].responses
warn
response-description-required
Every response must have a description.
$.paths[*][*].responses[*]
info
schema-property-camelcase
Schema property names should be camelCase, matching Edamam's JSON fields (e.g. totalNutrients, healthLabels, foodId). Underscore-prefixed HATEOAS keys like _links and SCREAMING_SNAKE nutrient codes are permitted.
$.components.schemas[*].properties[*]~
info
schema-object-type
Schemas should declare a type.
$.components.schemas[*]
warn
security-global-defined
A global security requirement should be defined.
$
warn
security-schemes-defined
Security schemes must be defined under components.
$.components
info
security-scheme-description
Each security scheme should be described.
$.components.securitySchemes[*]
error
get-no-request-body
GET operations must not declare a request body.
$.paths[*].get
info
post-has-request-body
POST operations should declare a request body.
$.paths[*].post
info
operation-microcks-extension
Operations should carry an x-microcks-operation extension for mock-server compatibility.
$.paths[*][get,post,put,patch,delete]
info
response-examples-encouraged
JSON responses should provide examples.
$.paths[*][*].responses[*].content.application/json
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
info
schema-properties-casing
Schema properties should be snake_case (the dominant convention in this API).
$.components.schemas[*].properties
warn
error-schema-defined
A shared error schema (Error) should be defined for error payloads.
$.components.schemas
warn
no-empty-descriptions
Descriptions must not be empty strings.
$..description

Spectral Ruleset

Raw ↑
# edamam — 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: 4/4 servers on edamam.com
#   - query-params-casing: snake @ 77% (n=35)
#   - operationid-casing: camel @ 100% (n=7)
#   - schema-names-casing: pascal @ 100% (n=23)
#   - schema-properties-casing: snake @ 72% (n=92)
#   - security: global (root) — NOT emitting operation-security-required
#   - error-schema-defined: Error
#   - operation-documents-401: 100% adherence
#   - merge: kept 39 existing, added 5 measured, upgraded 0
#   - added: query-params-casing, schema-names-casing, schema-properties-casing, error-schema-defined, no-empty-descriptions
extends:
  - spectral:oas
rules:
  info-title-required:
    description: The API must have a title.
    severity: error
    given: $.info
    then:
      field: title
      function: truthy
  info-title-edamam-prefix:
    description: API title should start with "Edamam".
    severity: warn
    given: $.info.title
    then:
      function: pattern
      functionOptions:
        match: ^Edamam
  info-description-required:
    description: The API must have a meaningful description.
    severity: warn
    given: $.info
    then:
      field: description
      function: truthy
  info-description-min-length:
    description: The API description should be at least 40 characters.
    severity: info
    given: $.info.description
    then:
      function: length
      functionOptions:
        min: 40
  info-version-required:
    description: The API must declare a version.
    severity: error
    given: $.info
    then:
      field: version
      function: truthy
  info-contact-required:
    description: The API should declare contact information.
    severity: info
    given: $.info
    then:
      field: contact
      function: truthy
  openapi-version-3-1:
    description: Edamam specs target OpenAPI 3.1.x.
    severity: warn
    given: $.openapi
    then:
      function: pattern
      functionOptions:
        match: ^3\.1\.
  servers-defined:
    description: At least one server must be defined.
    severity: error
    given: $.servers
    then:
      function: length
      functionOptions:
        min: 1
  servers-https-only:
    description: Servers must use HTTPS.
    severity: error
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: ^https://
  servers-edamam-host:
    description: Production server should be api.edamam.com.
    severity: info
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: api\.edamam\.com
  servers-description:
    description: Each server should have a description.
    severity: info
    given: $.servers[*]
    then:
      field: description
      function: truthy
  paths-no-trailing-slash:
    description: Paths must not end with a trailing slash.
    severity: warn
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        notMatch: .+/$
  paths-kebab-case:
    description: Path segments should be lowercase kebab-case (allowing version tokens like v2 and {param}
      placeholders).
    severity: warn
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        match: ^(/(\{[a-zA-Z0-9_]+\}|[a-z0-9]+(-[a-z0-9]+)*))+$
  paths-no-query-string:
    description: Path keys must not contain query strings.
    severity: error
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        notMatch: \?
  operation-operationId-required:
    description: Every operation must declare an operationId.
    severity: error
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: operationId
      function: truthy
  operation-operationId-camelcase:
    description: operationId should be camelCase (e.g. searchRecipes, analyzeIngredient).
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].operationId
    then:
      function: pattern
      functionOptions:
        match: ^[a-z][a-zA-Z0-9]*$
  operation-summary-required:
    description: Every operation must have a summary.
    severity: warn
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: summary
      function: truthy
  operation-summary-edamam-prefix:
    description: Operation summaries should be prefixed with "Edamam".
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].summary
    then:
      function: pattern
      functionOptions:
        match: '^Edamam '
  operation-description-required:
    description: Every operation should have a description.
    severity: info
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: description
      function: truthy
  operation-tags-required:
    description: Every operation must be tagged.
    severity: warn
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: tags
      function: truthy
  tags-global-defined:
    description: A global tags array should be defined.
    severity: info
    given: $
    then:
      field: tags
      function: truthy
  tag-description-required:
    description: Each global tag should have a description.
    severity: info
    given: $.tags[*]
    then:
      field: description
      function: truthy
  tag-title-case:
    description: Tag names should be Title Case (e.g. "Recipe Search", "Food Database").
    severity: warn
    given: $.tags[*].name
    then:
      function: pattern
      functionOptions:
        match: ^[A-Z][A-Za-z0-9]*( [A-Z][A-Za-z0-9]*)*$
  parameter-description-required:
    description: Every parameter should have a description.
    severity: warn
    given: $.paths[*][*].parameters[*]
    then:
      field: description
      function: truthy
  parameter-schema-type:
    description: Every parameter schema must declare a type.
    severity: warn
    given: $.paths[*][*].parameters[*].schema
    then:
      field: type
      function: truthy
  parameter-example-encouraged:
    description: Parameters should provide an example value.
    severity: info
    given: $.paths[*][*].parameters[*]
    then:
      field: example
      function: truthy
  request-body-json:
    description: Request bodies should offer application/json content.
    severity: warn
    given: $.paths[*][post,put,patch].requestBody.content
    then:
      field: application/json
      function: truthy
  response-2xx-required:
    description: Every operation must define at least one 2xx response.
    severity: error
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      field: '200'
      function: truthy
  response-401-defined:
    description: Authenticated operations should document a 401 response.
    severity: info
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      field: '401'
      function: truthy
  response-description-required:
    description: Every response must have a description.
    severity: warn
    given: $.paths[*][*].responses[*]
    then:
      field: description
      function: truthy
  schema-property-camelcase:
    description: Schema property names should be camelCase, matching Edamam's JSON fields (e.g. totalNutrients,
      healthLabels, foodId). Underscore-prefixed HATEOAS keys like _links and SCREAMING_SNAKE nutrient
      codes are permitted.
    severity: info
    given: $.components.schemas[*].properties[*]~
    then:
      function: pattern
      functionOptions:
        match: ^(_?[a-z][a-zA-Z0-9]*|[A-Z][A-Z0-9_.]*)$
  schema-object-type:
    description: Schemas should declare a type.
    severity: info
    given: $.components.schemas[*]
    then:
      field: type
      function: truthy
  security-global-defined:
    description: A global security requirement should be defined.
    severity: warn
    given: $
    then:
      field: security
      function: truthy
  security-schemes-defined:
    description: Security schemes must be defined under components.
    severity: warn
    given: $.components
    then:
      field: securitySchemes
      function: truthy
  security-scheme-description:
    description: Each security scheme should be described.
    severity: info
    given: $.components.securitySchemes[*]
    then:
      field: description
      function: truthy
  get-no-request-body:
    description: GET operations must not declare a request body.
    severity: error
    given: $.paths[*].get
    then:
      field: requestBody
      function: falsy
  post-has-request-body:
    description: POST operations should declare a request body.
    severity: info
    given: $.paths[*].post
    then:
      field: requestBody
      function: truthy
  operation-microcks-extension:
    description: Operations should carry an x-microcks-operation extension for mock-server compatibility.
    severity: info
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: x-microcks-operation
      function: truthy
  response-examples-encouraged:
    description: JSON responses should provide examples.
    severity: info
    given: $.paths[*][*].responses[*].content.application/json
    then:
      field: examples
      function: truthy
  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: info
    given: $.components.schemas[*].properties
    then:
      field: '@key'
      function: casing
      functionOptions:
        type: snake
  error-schema-defined:
    description: A shared error schema (Error) should be defined for error payloads.
    severity: warn
    given: $.components.schemas
    then:
      field: Error
      function: truthy
  no-empty-descriptions:
    description: Descriptions must not be empty strings.
    severity: warn
    given: $..description
    then:
      function: truthy