no-schema-dollar-id-empty-fragment
Overview
This rule belongs to the openapi-v3-syntax-linting
ruleset and states that:
The value of $id in a Schema Object must be a valid URI that must not contain a fragment value. This means that an empty fragment (only # appended at the end of the URI) should not be used either.
Property | Value |
---|---|
Enabled | Yes |
Maximum Severity | Warning |
Message | URI provided in $id of Schema Object contains an empty fragment. |
Code | OPENAPI3SYNTAX_L141 |
Type | Linting |
Rule System | Syntax |
Broad Category | Schemas |
Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
Tags | openapi3 openapi syntax linting fragment uri $id id json schema schema |
Suggested Fixes
- Remove the # from the end of the URI.
- An empty URI fragment is a special case where the fragment identifier consists of only the '#' character with no additional characters following it e.g.
https://example.com/index.html#
. - Ensure that the $id URI does not contain a fragment i.e. remove # or anything after # from the end of the URI.
- Ensure that $id is a valid URI.
For More Information
- 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://datatracker.ietf.org/doc/html/rfc3986
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#openapi-specification
- https://docs.apimatic.io/rulesets/overview/