required-paths-or-components-or-webhooks
Overview
This rule belongs to the openapi-v3-standards-validation ruleset and states that:
The OpenAPI root object in an OpenAPI v3.1.x document must specify at least one of the following: available paths and operations for the API using the paths property OR reusable components using the components property OR information about incoming webhooks using the webhooks property.
| Property | Value |
|---|---|
| Enabled | Yes |
| Maximum Severity | Error |
| Message | None of the required properties (paths, components or webhooks) were specified in the root OpenAPI Object. |
| Code | OPENAPI3STANDARDS_V005 |
| Type | Validation |
| Rule System | Semantic |
| Broad Category | OpenAPI Root Information |
| Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
| Tags | openapi3 openapi standards semantic validation paths components webhooks |
Suggested Fixes
- If you intend to describe your API's endpoints, your OpenAPI document must contain the
pathsproperty in the root OpenAPI object i.e. in the top level properties of the document. - If you want to declare reusable components in your OpenAPI document, it must contain the
componentsproperty in the root OpenAPI object i.e. in the top level properties of the document. - If you want the OpenAPI document to include data related to incoming webhooks from your API, do specify the
webhooksproperty in your root OpenAPI object i.e. in the top level properties of the document. - Make sure that the root object of your OpenAPI document(s) consist of at least one of these top-level properties:
paths,components,webhooks.
For More Information
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#openapi-document
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#openapi-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#pathsObject
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#oasComponents
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#oasWebhooks
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#openapi-specification
- https://docs.apimatic.io/rulesets/overview/