valid-schema-dollar-id-format
Overview
This rule belongs to the openapi-v3-syntax-validation
ruleset and states that:
The value of $id
in a Schema Object must be a URI-reference (absolute URI or relative reference). If a relative path is used it must resolve to an absolute URI. $id
must not contain a non-empty fragment value.
Property | Value |
---|---|
Enabled | Yes |
Maximum Severity | Error |
Message | URI provided in $id of the Schema Object is invalid. |
Code | OPENAPI3SYNTAX_V140 |
Type | Validation |
Rule System | Syntax |
Broad Category | Schemas |
Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
Tags | openapi3 openapi syntax validation uri $id id json schema schema |
Suggested Fixes
- A URI-reference can be an absolute URI or a relative path.
- Ensure that the $id path is a valid absolute/relative URI.
- Ensure that the $id does not contain forbidden characters.
- Ensure that the $id URI does not contain a fragment i.e. remove
#
or anything after # from the end of the URI.
For More Information
- https://datatracker.ietf.org/doc/html/rfc3986#section-4.1
- https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-8.2.1
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#schema-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#openapi-specification
- https://docs.apimatic.io/rulesets/overview/