-
Notifications
You must be signed in to change notification settings - Fork 15
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
error parsing a ref based schema #38
Comments
I'll inline the top level object and see how that works |
It worked once I did that. Looks like it was that it didnt expect the top level to be using a reference. Guess I'll do a minor rewrite for these schemas |
Also, importing an array of $refs translates into a Type.Union() that doesn't include the square brackets which breaks the output. It actually shouldn't bring a Union, just the Type.Object |
Just a heads up. The signature for Ref changed on 0.34.0. The Ref signature was updated to accept a string argument. // 0.33.0
const T = Type.String({ $id: 'T' })
const R = Type.Ref(T)
// 0.34.0
const T = Type.String({ $id: 'T' })
const R = Type.Ref('T') I have noticed this issue this morning, and for now reverted the 0.33.0 signature on 0.34.7 under a const T = Type.String({ $id: 'T' }) // previously generated type
// This is the recommend way to support raw references in 0.34.0 and beyond.
const R = Type.Unsafe<Static<typeof T>>(Type.Ref(T.$id!)) This should resolve any https://github.com/sinclairzx81/typebox?tab=readme-ov-file#module-types With code generation also integrated via the new Syntax Types feature https://github.com/sinclairzx81/typebox?tab=readme-ov-file#module Hope this helps |
Library version:
1.7.1
JSON schema version: draft-04
The current behavior
Fails to parse with
Unsupported schema
.The expected behavior
Parsing correctly. What I would really like is a separate typebox definition for each defined schema, but getting the top level schema is good, since i can pull it apart when I use it.
Why does it happen? What/How to fix the issue?
Probably the top level ref -> definitions usage. It is valid tho afaik, was working with my other tools. Hard to say since this is the only thing I've attempted to use this cli for.
Content of minimal json schema file which causes the problem
Click to expand/collapse
The text was updated successfully, but these errors were encountered: