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
Exposing details of the Schema, subSchema, etc by making them interfaces #227
Comments
The problem I have with exposing That pretty much rules out the possibility to create an external library that does #216 for you using I'm interested though how you would implement it. If you only use TLDR; |
The question about how to handle non-required and anyOf/oneOf/allOf is a good one. The answer to the question is that it would depend on the use case. For example, for the case of oneOf, a reasonable behavior would be to randomly select one of them. The above ambiguity demonstrates the need for exposing public interfaces for schema and subschema. Different use cases for json generation would need different -- and possibly custom -- implementations. Having the JSON schema details available outside of gojsonschema (or similar library) is a prerequisite for JSON generation from a schema. |
In those cases I can see your argument why it would make sense to have this functionality separate. This doesn't change my current opinion that I don't want to expose If it is of any consolidation draft-08 requires implementations to have more modular designs which have to provide users of an implementation to add custom logic. There might be a way of implementing that that makes it possible to expose the internals in a clean way, but since this is a hobby project I'm not going to make any promises on when that's going to happen. |
Hi @johandorland, @xeipuuv, we are working on a project where we need to traverse the Schema structure that results from compilation and generate a type for it in a different language. So we have also encountered the problem that SubSchema and its fields are not public. I wonder if you have reconsidered this issue and/or would be willing to accept a PR that offers a visitor for Schema? @aavarghese |
Looking at enhancement request #216, if some of the internal details were exposed through interfaces, external libraries could implement JSON generation.
Would this be amenable to the authors? Would a PR be considered?
The text was updated successfully, but these errors were encountered: