valid-dollar-ref-path
Overview
This rule belongs to the openapi-v3-syntax-validation
ruleset and states that:
$ref values must be RFC3986-compliant percent-encoded URIs.
Property | Value |
---|---|
Enabled | Yes |
Maximum Severity | Error |
Message | Provided $ref path is invalid. |
Code | OPENAPI3SYNTAX_V120 |
Type | Validation |
Rule System | Syntax |
Broad Category | References |
Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
Tags | openapi3 openapi syntax validation $ref uri reference |
Suggested Fixes
- Ensure that the value of $ref is a valid URI.
- Ensure that any literal forward slashes are replaced by ~1 each.
- Ensure that the URI value does not contain any forbidden characters.
- Ensure that the $ref value is not empty or null.
- Ensure that the reference path set in the $ref property is a valid path to the component you intend to reference.
- If the reference path to the component is unknown remove the Reference Object and define the component directly.
For More Information
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#reference-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#relative-references-in-uris
- https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-8.2.3.1
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#reference-object
- https://datatracker.ietf.org/doc/html/rfc3986
- https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#openapi-specification
- https://docs.apimatic.io/rulesets/overview/