OpenAPI

426 rules

REST API descriptions — paths, operations, schemas, and security.

Array Items info experience: data-modelingexperience: reliability spec: schemas
Array Items.
Channel Parameter Require Examples info experience: documentationexperience: usability spec: channelsspec: parametersspec: schemas
Parameter must have examples.
Component Example Keys Snake Case info experience: namingexperience: consistency spec: componentsspec: examples
example key must be snake cased (e.g. snake_case).
Component Message Require Examples info experience: documentationexperience: usability spec: messagesspec: components
Message must have examples.
Component Require Security Schemes info experience: securityexperience: governance spec: components owasp: api2
The API contract MUST include a 'securitySchemes' subsection under the 'components' section.
Contact Properties info experience: documentationexperience: discoverability spec: info
Contact object must have "name", "url" and "email".
Document Cache Control Parameter info experience: documentationexperience: reliabilityexperience: performance spec: parametersspec: headers topic: caching
Cache usage SHOULD be extensively detailed in the `description` property to avoid data leaks or the usage of stale data. This rule should ensure in some way that the api provider documented extensively the cache usage to avoid data leaks or usage of stale data. For now this ruleset tests: * the presence of following keywords in the `description`: `max-age`, `private`, `no-store`, `no-cache`. * that one and only one between Expires and Cache-Control is used. `Cache-Control` and `Expires` should not be used in conjuction, because `Cache-Control` overrides `Expires` when `max-age` is set. Instead if neither `Cache-Control` or `Expires` are set, clients MAY use euristic cache like described in RFC7234.
Document Cache Response Header info experience: documentationexperience: reliabilityexperience: performance spec: responsesspec: headers topic: caching
Cache usage SHOULD be extensively detailed in the `description` property to avoid data leaks or the usage of stale data. This rule should ensure in some way that the api provider documented extensively the cache usage to avoid data leaks or usage of stale data. For now this ruleset tests: * the presence of following keywords in the `description`: `max-age`, `private`, `no-store`, `no-cache`. * that one and only one between Expires and Cache-Control is used. `Cache-Control` and `Expires` should not be used in conjuction, because `Cache-Control` overrides `Expires` when `max-age` is set. Instead if neither `Cache-Control` or `Expires` are set, clients MAY use euristic cache like described in RFC7234.
Document OWASP API9 Server info experience: securityexperience: governance spec: servers owasp: api9
The API should declare its servers so all hosts and environments are inventoried — undocumented or stray non-production hosts are a common inventory-management risk (OWASP API9).
Document Require Component Section info experience: consistencyexperience: governance spec: document
The API contract MUST include a 'components' section.
Document Require External Docs info experience: documentationexperience: discoverability spec: document
Defining external documentation provides a link to detailed API guides, tutorials, and reference material beyond the OpenAPI spec. Analysis shows 57.1% of APIs include external docs.
Document Require Jsonschemadialect info experience: governanceexperience: discoverability spec: document
openapi document should declare a `jsonSchemaDialect` property.
Document Require Openapi info experience: governanceexperience: discoverability spec: document
openapi document should declare a `openapi` property.
Document Require Path info experience: governanceexperience: discoverability spec: document
openapi document should declare a `paths` property.
Document Require Realistic Examples info experience: documentationexperience: usability spec: examples
API design SHOULD include real-like examples for request and response definitions.
Document Require Server Defined info experience: usabilityexperience: discoverability spec: document
Every OpenAPI should define at least one server URL. Analysis shows 97.2% of APIs define servers, providing consumers with the base URL needed to make requests.
Document Require Webhooks info experience: governanceexperience: discoverability spec: document
openapi document should declare a `webhooks` property.
Document Spec Must Not Be Empty info experience: governance spec: document
Spec should not be empty.
Duplicated Entry In Enum info experience: data-modelingexperience: consistency spec: schemas
Enum values must not have duplicate entry.
Header Names Hyphenated Pascal Case info experience: namingexperience: consistency spec: parametersspec: headers
All `HTTP` headers MUST use `Hyphenated-Pascal-Case` notation.
Header No X Prefix info experience: namingexperience: consistency spec: parametersspec: headers
'HTTP' headers SHOULD NOT start with 'X-' RFC6648.
Header Require Examples info experience: documentationexperience: usability spec: headers
Headers must include examples.
Info Contact info experience: documentationexperience: discoverability spec: document
Info object must have "contact" object.
Info Contact Require Email info experience: discoverabilityexperience: documentation spec: info
Having a contact email address associated with the technical contract ensures that anyone who comes across the API has someone to email and get more information.
Info Contact Require Name info experience: discoverabilityexperience: documentation spec: info
Having a contact name associated with the technical contract ensures that anyone who comes across the API knows who to contact.
Info Contact Require URL info experience: discoverabilityexperience: documentation spec: info
Having a contact url associated with the technical contract ensures that anyone who comes across the API knows where to go to contact someone.
Info Description info experience: documentation spec: document
Info "description" must be present and non-empty string.
Info Description Length Limit info experience: documentationexperience: consistency spec: info
Having a restriction on the length of the API description expressed as the OpenAPI info description helps provide constraints for consumers when adding a description, and keeps portals, landing pages, documentation, and discovery results more consistent.
Info Description No Eval Tag info experience: securityexperience: documentation spec: info
Eval functions MUST not be included in the description of an API, keeping descriptions to just the text that is needed, and relying on the rest of the OpenAPI to describe what is possible.
Info Description No Script Tag info experience: securityexperience: documentation spec: info
Script tags MUST not be included in the description of an API, keeping descriptions to just the text that is needed, and relying on the rest of the OpenAPI to describe what is possible.
Info License info experience: documentationexperience: governance spec: document
Info object must have "license" object.
Info License Require Name info experience: governanceexperience: documentation spec: info
The license object should include a name property identifying the license type, such as Apache 2.0, MIT, or a proprietary license.
Info License Require URL info experience: governanceexperience: documentation spec: info
The license object should include a URL linking to the full license text so API consumers can review the terms.
Info Microcks Extension Valid info experience: governanceexperience: consistency spec: info
x-microcks extension must be valid.
Info OWASP API9 Document Version info experience: securityexperience: governance spec: info owasp: api9
The API should declare a version in info.version so every published version is inventoried and retired versions can be tracked (OWASP API9 — improper inventory management).
Info Require API Identifier info experience: discoverabilityexperience: governance spec: document
The `#/info/x-api-id` field can be used to associate an identifier to an API. This is useful to track an API even when its `#/info/title` changes.
Info Require Contact 2 info experience: discoverabilityexperience: documentation spec: info
Having a contact object associated with the technical contract ensures that anyone who comes across the API has someone to contact and get more information.
Info Require Description info experience: documentation spec: info
Info section is missing a description.
Info Require License info experience: governanceexperience: documentation spec: info
Having a license defined in the info object clarifies the terms under which the API can be used. Analysis shows only 44.4% of APIs define a license, but it is essential for API governance and compliance.
Info Require Openapi Version 3x info experience: versioningexperience: governance spec: document
APIs should use OpenAPI 3.x specification. Analysis of 773 API specs shows 97% use OpenAPI 3.x, with 86% on 3.1.0, making it the dominant standard for modern API definitions.
Info Require Summary info experience: documentationexperience: discoverability spec: document
The `#/info/x-summary` can be used to specify a brief, one-liner description of your API: this is very useful for catalog purposes (eg. this can be shown as your API subtitle in catalogs and developer portals). In OAS3.1 you can use the standard `#/info/summary` field.
Info Require Terms Of Service info experience: documentationexperience: governance spec: document
API MUST reference the URL of the Terms of Service in `#/info/termsOfService`.
Info Require Title info experience: documentationexperience: discoverability spec: info
Having a intuitive and helpful title for your API using the OpenAPI info title is the first impression you will make on the consumers of your API.
Info Require Version info experience: versioning spec: info
Publishing a version for your OpenAPI technical contract helps you communicate change with consumers using Semantic or date-based versioning published to the info version property.
Info Title Capitalized info experience: namingexperience: consistency spec: info
Having a consistent casing for the title for your API helps provide constraints for teams naming the API, but also keep consistent with other APIs from across teams.
Info Title Max Length info experience: consistencyexperience: documentation spec: info
Having a limitation on the length of the title for your API helps provide constraints for teams naming it, but also keep consistent with other APIs from across teams.
Info Version Must Be Semver info experience: versioningexperience: consistency spec: info
The API version field should follow [semantic versioning](https://semver.org/#semantic-versioning-specification-semver).
Info Version Must Use Semver info experience: versioningexperience: consistency spec: info
Version should use semantic versioning. {{value}} is not a valid version.
Info Version Semantic And Stable info experience: versioningexperience: consistency spec: info
The API contract MUST have a stable version and MUST follow semantic versioning (e.g., '1.0.0'). Words like 'SNAPSHOT' or 'RELEASE' are not allowed.
License URL info experience: documentationexperience: governance spec: document
License object must include "url".
Limit Nested Sub Resources info experience: usabilityexperience: consistency spec: paths
The hierarchy of nested resources SHOULD NOT contain more than 8 resource names in the path.
Limit Path Length info experience: usabilityexperience: consistency spec: paths
APIs SHOULD NOT expand their total URL length beyond a few hundred characters.
Limit Path Parameter info experience: usabilityexperience: consistency spec: paths
The URL path should not contain more than 3 dynamic path parameters.
Message Examples Form Complete Mocks info experience: documentationexperience: usability spec: channels
Message example must match params examples to form full mocks.
Message Require Examples info experience: documentationexperience: usability spec: channelsspec: messages
Message must have examples.
No $ref Siblings info experience: reliabilityexperience: consistency spec: schemas
Property must not be placed among $ref.
No Eval In Markdown info experience: security spec: document
Markdown descriptions must not have "eval(".
No Script Tags In Markdown info experience: security spec: document
Markdown descriptions must not have "