specification-extension-name-begin-with-x-dash
Overview
This rule belongs to the openapi-v3-syntax-validation
ruleset and states that:
If any additional property needs to be added in the OpenAPI specification that is otherwise not part of the actual standard, specification extensions can be used for this purpose at certain points. The extension name must begin with x- (e.g. x-internal-id). An exception to this rule is only for Schema Objects of OpenAPI v3.1.x documents that allows extension names to start even without x-.
Property | Value |
---|---|
Enabled | Yes |
Maximum Severity | Error |
Message | Specification extension name is invalid. |
Code | OPENAPI3SYNTAX_V200 |
Type | Validation |
Rule System | Syntax |
Broad Category | Specification Extensions |
Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
Tags | openapi3 openapi syntax validation name specification extensions vendor extensions extensions |
Suggested Fixes
- Make sure that the name of the extension begins with a lower case 'x' which is then followed by a dash '-'. There must be no space between the two.
- There must be no trailing whitespace characters at the start of the extension name.
- Ensure that the current object allows for extensions.
For More Information
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#specification-extensions
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#openapi-specification
- https://docs.apimatic.io/rulesets/overview/