We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Given a self-referencing type:
const Test = z.lazy(() => z.object({ id: z.string(), test: z.optional(Test), }), )
When using zodToJsonSchema, the produced JSON schema is as follows:
{ "type": "object", "properties": { "id": { "type": "string" }, "test": { "$ref": "#/" // <- this one } }, "required": [ "id" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" }
The issue arises with the "$ref" property under "test," which currently contains #/. According to RFC6901, this points to an empty string property:
#/
{ "": "this" }
To adhere to the RFC, the $ref property should simply contain #, pointing to the entire document.
#
The text was updated successfully, but these errors were encountered:
Fair. Fix published in 3.22.3
Sorry, something went wrong.
No branches or pull requests
Given a self-referencing type:
When using zodToJsonSchema, the produced JSON schema is as follows:
The issue arises with the "$ref" property under "test," which currently contains
#/
. According to RFC6901, this points to an empty string property:To adhere to the RFC, the $ref property should simply contain
#
, pointing to the entire document.The text was updated successfully, but these errors were encountered: