Skip to content
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

support "type": ["object", "null"] #115

Open
Tloe opened this issue Nov 1, 2023 · 1 comment
Open

support "type": ["object", "null"] #115

Tloe opened this issue Nov 1, 2023 · 1 comment

Comments

@Tloe
Copy link

Tloe commented Nov 1, 2023

I need to set "type": ["object", "null"] in my json schema, but haven't found a way to do this. Is there a way?

For now I use Reflect and then set .Type = "[object, null]" and then when the schema is done I do a replace all.. it works, but is a little hacky

@candiduslynx
Copy link
Contributor

Use jsonschema:"nullable" until #110 is merged, then you'll have an option to specify all nullable Go types to be marked as nullable.
In case of this library, the {"oneof":[{spec}, {"type":"null"}] will be generated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants