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

Is anyof_required supported? #41

Closed
deepjyoti30 opened this issue Aug 24, 2022 · 3 comments
Closed

Is anyof_required supported? #41

deepjyoti30 opened this issue Aug 24, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@deepjyoti30
Copy link
Contributor

I saw from the examples in README that oneof_required is supported however there was no mention of anyOf. Looked through the source code and found that there's just one place in the code where anyOf is defined but for oneof_required there were a few lines that was parsing the oneof_required into the parent. Code for that can be found here

My question is whether or not anyof_required is supported in the same way that oneof_required is supported. I tried generating the schema with anyof_required and it didn't generate any anyOf array however anyOf is a valid part of JSON schema so it should be supported?

@samlown
Copy link
Contributor

samlown commented Aug 29, 2022

Hi! No, not at the moment, but as you say, the implementation would be quite similar to the oneof syntax. PRs welcome :-)

My recommendations for these rare cases would be to avoid the Go tags and define your own JSONSchema method. You can find an example of defining the oneOf property manually here: https://github.com/invopop/gobl/blob/main/org/notes.go#L263-L278 The implementation with anyOf would be very similar.

@deepjyoti30
Copy link
Contributor Author

Hey @samlown added a PR for supporting anyof_required and anyof_type. Will close this issue once the PR is merged.

@samlown
Copy link
Contributor

samlown commented Sep 6, 2023

This should be sorted now. Closing.

@samlown samlown closed this as completed Sep 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants