NGINX · API Governance Rules
NGINX API Rules
Spectral linting rules defining API design standards and conventions for NGINX.
55 Rules
error 15
warn 18
info 22
Rule Categories
general
http
info
no
openapi
operation
parameter
paths
query
response
schema
security
servers
tags
Rules
error
info-title-starts-with-nginx
API title must start with "NGINX"
$.info.title
error
info-description-required
API must have a description
$.info
error
info-version-required
API must have a version
$.info
info
info-contact-recommended
API should include contact information
$.info
info
info-license-recommended
API should include license information
$.info
warn
openapi-version-3
OpenAPI version should be 3.x
$.openapi
error
openapi-or-swagger-defined
Spec must declare openapi or swagger version
$
warn
servers-https-required
Server URLs must use HTTPS
$.servers[*].url
info
servers-description-required
Each server should have a description
$.servers[*]
warn
servers-not-empty
Servers array should not be empty
$.servers
warn
paths-lowercase
Path segments must be lowercase
$.paths
info
paths-no-trailing-slash
Paths should not have a trailing slash (except root)
$.paths
info
paths-use-underscores
NGINX paths use underscores for multi-word segments
$.paths
warn
paths-parameter-camel-case
Path parameters should use camelCase
$.paths
error
operation-summary-required
Every operation must have a summary
$.paths[*][get,post,put,patch,delete]
error
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-summary-starts-with-nginx
Operation summary should start with "NGINX" for branding consistency
$.paths[*][get,post,put,patch,delete].summary
warn
operation-operationid-camel-case
operationId should use camelCase
$.paths[*][get,post,put,patch,delete].operationId
info
operation-operationid-verb-prefix
operationId should start with an HTTP-related verb (get, post, put, patch, delete, create, update, list, reset)
$.paths[*][get,post,put,patch,delete].operationId
info
operation-summary-no-period
Operation summary should not end with a period
$.paths[*][get,post,put,patch,delete].summary
warn
tags-title-case
Tags should use Title Case
$.paths[*][get,post,put,patch,delete].tags[*]
error
tags-required
Every operation should have at least one tag
$.paths[*][get,post,put,patch,delete]
error
tags-not-empty
Tags array should not be empty
$.paths[*][get,post,put,patch,delete].tags
info
tags-global-defined
Global tags array should be defined
$
error
parameter-description-required
Every parameter must have a description
$..parameters[*]
warn
parameter-name-camel-case
Parameter names should use camelCase
$..parameters[*].name
error
parameter-path-required
Path parameters must be marked as required
$..parameters[?(@.in=='path')]
error
parameter-type-defined
Parameters should have a type or schema defined
$..parameters[*]
info
parameter-query-fields-pattern
NGINX APIs commonly use a "fields" query parameter for field filtering
$..parameters[?(@.in=='query')].name
error
response-success-required
Every operation must define at least one success response (2xx)
$.paths[*][get,post,put,patch,delete].responses
warn
response-error-404
GET operations should define a 404 response
$.paths[*].get.responses
info
response-error-405-on-delete
DELETE operations should define a 405 response for method disabled
$.paths[*].delete.responses
error
response-description-required
Every response must have a description
$.paths[*][get,post,put,patch,delete].responses[*]
warn
response-get-200-has-content
GET 200 responses should define a response body schema
$.paths[*].get.responses.200
warn
response-delete-204
DELETE operations should return 204 on success
$.paths[*].delete.responses
info
response-error-schema-consistent
Error responses should reference a consistent error schema (NginxError)
$.paths[*][get,post,put,patch,delete].responses[?(@property >= '400' && @property < '600')]
warn
schema-property-camel-case
Schema properties should use camelCase
$..properties
info
schema-description-recommended
Schemas should include a description
$.components.schemas[*]
warn
schema-type-required
Schemas should declare a type
$.components.schemas[*]
info
schema-properties-have-description
Schema properties should include descriptions
$..properties[*]
info
schema-nginx-prefix
NGINX API definition/schema names should use the Nginx prefix
$.definitions
info
security-global-defined
API should define security at the global or operation level
$
info
security-schemes-defined
Security schemes should be declared if security is used
$.components
error
http-get-no-request-body
GET operations should not have a request body
$.paths[*].get
warn
http-delete-no-request-body
DELETE operations should not have a request body
$.paths[*].delete
info
http-post-request-body
POST operations should have a request body
$.paths[*].post
info
http-patch-request-body
PATCH operations should have a request body
$.paths[*].patch
info
general-description-min-length
Descriptions should be meaningful (at least 20 characters)
$.paths[*][get,post,put,patch,delete].description
info
general-no-empty-paths
Paths object should not be empty (unless intentional like njs)
$.paths
info
general-external-docs-recommended
API should link to external documentation
$
info
general-produces-json
NGINX APIs should produce application/json responses
$.paths[*].get.produces
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
no-empty-descriptions
Descriptions must not be empty strings.
$..description