An API of Ice And Fire · API Governance Rules
An API of Ice And Fire API Rules
Spectral linting rules defining API design standards and conventions for An API of Ice And Fire.
53 Rules
error 16
warn 26
info 11
Rule Categories
error
examples
get
http
info
no
openapi
operation
parameter
path
paths
query
response
schema
security
servers
tags
Rules
error
info-title-format
info.title MUST equal "An API of Ice And Fire".
$.info.title
error
info-description-required
info.description MUST be present and at least 80 characters.
$.info
error
info-version-required
info.version MUST be present.
$.info
warn
info-contact-required
info.contact with name and url MUST be present.
$.info
warn
info-license-required
info.license MUST be present (BSD-style).
$.info
error
openapi-version-three
OpenAPI version MUST be 3.x.
$.openapi
error
servers-defined
At least one server MUST be defined.
$.servers
error
servers-https-only
Server URLs MUST use HTTPS.
$.servers[*].url
warn
servers-anapioficeandfire-host
Production server MUST point at anapioficeandfire.com.
$.servers[*].url
warn
servers-description-required
Every server MUST have a description.
$.servers[*]
warn
paths-kebab-case
Path segments MUST be lowercase kebab-case (plural collection nouns).
$.paths.*~
warn
paths-no-trailing-slash
Paths MUST NOT end with a trailing slash (except root `/`).
$.paths.*~
error
paths-no-query-strings
Paths MUST NOT include query strings.
$.paths.*~
info
paths-plural-collection-nouns
Top-level resources use plural nouns (books, characters, houses).
$.paths.*~
error
operation-summary-required
Every operation MUST have a summary.
#Operation
warn
operation-summary-provider-prefix
Operation summaries MUST start with "An API of Ice And Fire".
#Operation.summary
error
operation-description-required
Every operation MUST have a description.
#Operation
error
operation-id-required
Every operation MUST have an operationId.
#Operation
error
operation-id-camel-case
operationId MUST be camelCase.
#Operation.operationId
warn
operation-id-verb-prefix
operationId SHOULD start with get, list, create, update, or delete.
#Operation.operationId
error
operation-tags-required
Every operation MUST have at least one tag.
#Operation
info
operation-microcks-extension
Operations SHOULD declare x-microcks-operation for mock-server compatibility.
#Operation
warn
tags-global-defined
Global `tags` array MUST be defined.
$
warn
tags-have-description
Every global tag MUST have a description.
$.tags[*]
warn
tags-title-case
Tag names MUST be Title Case single words (Books, Characters, Houses, Root).
$.tags[*].name
warn
parameter-description-required
Every parameter MUST have a description.
$..parameters[?(@.name)]
warn
parameter-camel-case
Query and path parameter names MUST be camelCase.
$..parameters[?(@.name)].name
warn
parameter-pagination-naming
Pagination MUST use `page` + `pageSize` (not page/limit, page/size, or offset/limit).
$..parameters[?(@.in=='query')].name
info
parameter-page-default
The `page` parameter SHOULD default to 1.
$.components.parameters.Page.schema
warn
parameter-page-size-max-fifty
The `pageSize` parameter MUST cap at 50.
$.components.parameters.PageSize.schema
error
response-success-required
Every operation MUST declare a 200 response.
#Operation.responses
warn
response-not-found-on-get-by-id
get-by-id operations MUST declare a 404 response.
$.paths[*][get].responses
info
response-rate-limited
Every operation SHOULD document the 403 rate-limit response.
#Operation.responses
info
response-conditional-not-modified
GET operations SHOULD document the 304 Not Modified response for conditional caching.
$.paths[*][get].responses
error
response-json-content-type
200 responses MUST use application/json.
$.paths[*][get,post,put,patch,delete].responses['200'].content
warn
response-description-required
Every response MUST have a description.
$.paths[*][get,post,put,patch,delete].responses[*]
warn
response-pagination-link-header
Collection list responses SHOULD include the RFC 5988 Link header.
$.paths[/books,/characters,/houses][get].responses['200'].headers
info
response-caching-headers
GET responses SHOULD include ETag, Last-Modified, and Cache-Control headers.
$.paths[*][get].responses['200'].headers
warn
schema-property-camel-case
Schema property names MUST be camelCase.
$.components.schemas[*].properties.*~
error
schema-type-required
Every component schema MUST declare a `type`.
#Schema
warn
schema-description-required
Every component schema MUST have a description.
#Schema
info
schema-url-self-link
Resource schemas SHOULD include a `url` self-link.
$.components.schemas[?(@.type=='object')]
warn
schema-related-resource-uri-format
Schema properties named like related-resource refs MUST use format=uri.
$.components.schemas[*].properties[url,father,mother,spouse,overlord,founder,currentLord,heir]
info
security-not-required
This API is unauthenticated; global `security` MUST NOT require credentials.
$
warn
http-only-get
An API of Ice And Fire is read-only — only GET operations are allowed.
$.paths[*]
error
get-no-request-body
GET operations MUST NOT have a requestBody.
$.paths[*][get]
warn
no-empty-descriptions
Descriptions MUST NOT be empty strings.
$..description
info
examples-encouraged
Operations SHOULD include named examples on 200 responses.
$.paths[*][get].responses['200'].content.application/json
warn
path-params-casing
Path parameters should be snake_case (the dominant convention in this API).
$.paths[*].parameters[?(@.in=='path')].name
info
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