Nutritionix · API Governance Rules
Nutritionix API Rules
Spectral linting rules defining API design standards and conventions for Nutritionix.
33 Rules
error 8
warn 18
info 7
Rule Categories
get
info
openapi
operation
parameter
paths
request
response
schema
security
servers
tags
Rules
warn
info-title-prefix
API title should begin with "Nutritionix".
$.info.title
warn
info-description-required
Info object must have a meaningful description.
$.info
error
info-version-required
Info object must declare a version.
$.info
info
info-contact-required
Info object should provide 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.
$.servers
error
servers-https
Server URLs must use HTTPS.
$.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-or-snake
Path segments should be lower case (kebab or snake), no camelCase.
$.paths[*]~
warn
operation-summary-required
Every operation must have a summary.
$.paths[*][get,post,put,patch,delete]
warn
operation-summary-prefix
Operation summaries should begin with "Nutritionix".
$.paths[*][get,post,put,patch,delete].summary
warn
operation-description-required
Every operation must have a description.
$.paths[*][get,post,put,patch,delete]
error
operation-operationId-required
Every operation must have an operationId.
$.paths[*][get,post,put,patch,delete]
warn
operation-operationId-camelcase
operationId values must be camelCase.
$.paths[*][get,post,put,patch,delete].operationId
warn
operation-tags-required
Every operation must declare at least one tag.
$.paths[*][get,post,put,patch,delete]
info
operation-microcks-extension
Operations should carry an x-microcks-operation extension for mock compatibility.
$.paths[*][get,post,put,patch,delete]
info
tags-global-defined
A global tags array should be defined.
$
info
tags-description
Each global tag should have a description.
$.tags[*]
warn
tags-title-case
Tag names should be Title Case.
$.tags[*].name
warn
parameter-description-required
Every parameter must have a description.
$.paths[*][*].parameters[*]
warn
parameter-snake-case
Query and path parameter names should be snake_case.
$.paths[*][*].parameters[?(@.in=='query' || @.in=='path')].name
warn
parameter-schema-type
Each parameter must define a schema with a type.
$.paths[*][*].parameters[*].schema
warn
request-body-json
Request bodies should offer an application/json media type.
$.paths[*][post,put,patch].requestBody.content
error
response-2xx-required
Every operation must define a successful (2xx) response.
$.paths[*][get,post,put,patch,delete].responses
info
response-401-defined
Operations should define a 401 response for missing/invalid credentials.
$.paths[*][get,post,put,patch,delete].responses
warn
response-description-required
Every response must have a description (unless it is a $ref).
$.paths[*][*].responses[?(!@.$ref)]
warn
schema-property-snake-case
Schema property names should be snake_case (allowing leading underscore).
$.components.schemas[*].properties[*]~
info
schema-description-required
Top-level component schemas should have a description.
$.components.schemas[*]
warn
security-global-defined
A global security requirement should be declared.
$
error
security-schemes-defined
Security schemes must be defined under components.
$.components.securitySchemes
warn
security-apikey-headers
Nutritionix authenticates via x-app-id and x-app-key API key headers.
$.components.securitySchemes[?(@.type=='apiKey')]
error
get-no-request-body
GET operations must not declare a request body.
$.paths[*].get