schema-valid-against-meta-schema
Overview
This rule belongs to the openapi-v3-standards-validation
ruleset and states that:
The Schema Object or the JSON schema resource must be valid against the meta-schema identified by the URI in its $schema
property.
Property | Value |
---|---|
Enabled | Yes |
Maximum Severity | Error |
Message | Schema is not valid against the meta-schema. |
Code | OPENAPI3STANDARDS_V339 |
Type | Validation |
Rule System | Semantic |
Broad Category | Schemas |
Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
Tags | openapi3 openapi standards semantic validation uri meta schema json schema $schema schema |
Suggested Fixes
- Ensure that the $schema value is a not empty or null.
- Ensure that the $schema value is a valid URI and points to a JSON schema resource.
- Ensure that the current JSON schema object is valid against the JSON schema referenced via the $schema URI.
- You can use any JSON schema/JSON data validator tool to verify the validity of the current schema (JSON data) against the meta-schema (JSON schema).
- Meta-schema is also a JSON schema but unlike JSON schemas that help validate JSON data, a meta-schema helps validate JSON schemas.
- $schema is a meta-schema resource identifier as well as the schema dialect identifier.
For More Information
- https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-8.1.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/