-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TT-12440] Update jsonschema support note #5916
base: master
Are you sure you want to change the base?
[TT-12440] Update jsonschema support note #5916
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
✅ PS. Pls add /docs/nightly to the end of url
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ PS. Pls add /docs/nightly to the end of url
To edit notification comments on pull requests, go to your Netlify site configuration. |
tyk-docs/content/product-stack/tyk-gateway/middleware/validate-request-tyk-classic.md
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@titpetric @andyo-tyk Can we remove the note and add the below section instead?
|
||
The Validate JSON middleware supports JSON Schema `draft-04`. Using another version will return an `unsupported schema error, unable to validate` error in the Tyk Gateway logs. | ||
By default the validator will try to detect the draft of a schema by using the $schema keyword and parse it in a strict draft-04, draft-06 or draft-07 mode. If $schema is missing, or the draft version is not explicitly set, a hybrid mode is used which merges together functionality of all drafts into one mode. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understanding JSON Schema Version Handling
The Gateway automatically detects the version of the JSON schema from the $schema
field in your schema definition. This field specifies the version of the JSON schema standard to be followed. Supported versions are draft-04, draft-06 and draft-07.
- If the
$schema
field is present, the Gateway strictly follows the rules of the specified version. - If the
$schema
field is missing or the version is not specified, the Gateway uses a hybrid mode that combines features from multiple schema versions. This mode ensures that the validation will still work, but may not enforce the exact rules of a specific version.
To ensure consistent and predictable validation, it is recommended to always include the $schema
field in your schema definition. For example:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"firstname": {
"type": "string"
},
"lastname": {
"type": "string"
}
}
}
By including $schema
, the validator can operate in strict mode, ensuring that the rules for your chosen schema version are followed exactly.
User description
https://tyktech.atlassian.net/browse/TT-12440
PR Type
Documentation
Description
Updated JSON schema validation note for middleware.
Added explanation of schema draft detection behavior.
Removed outdated note on supported JSON schema version.
Changes walkthrough 📝
validate-request-tyk-classic.md
Update JSON schema validation note and behavior explanation
tyk-docs/content/product-stack/tyk-gateway/middleware/validate-request-tyk-classic.md
$schema
.$schema
.