-
Notifications
You must be signed in to change notification settings - Fork 358
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
Public types #44
Comments
I can make the interface jsonLoader public, does that solve your issue ? |
I am currently using gojsonschema to validate input for a web application and I would like to avoid to reload the schema for every request from disk. With the pre-christmas version I could just load the schemas once and put them into a map for use by the requests. I guess I can use the jsonGoLoader to at least avoid file io for every request. So having JsonLoader public should solve the issue for me, let me try things first and I let you know. |
Maybe that is what you are looking for ? https://github.com/xeipuuv/gojsonschema/blob/master/README.md#validation |
Yes, and if JsonLoader is public I can do things like
and use the loader from the map later when validating my data. To create that map or any type with JsonLoader as member it has to be public. But I am open for different ideas if you want to keep it private. But making it public should not hurt because I guess the private loaders will always implement the JsonLoader interface anyway, right? |
This works, alternatively you can create a map of gojsonschema.Schema ( public ), Now you are right, i guess it makes sense to have the JSONLoader interface made public. |
Oh right, for my example a map of schemas would be more convenient. A public Loader interface could also enable more fancy loaders like fetching from databases over non http interfaces (e.g. protobuffer interface of riak) and things like that, that do not need to be built in but could come in handy in specific use cases. |
I agree |
interface made public
Do you plan on making types and interfaces like jsonLoader public (like it was with for example JsonSchemaDocument before)?
That would simplify definition of types/structs that have loaders as members or function paramerters.
If not could you suggest an alternative to achive the same without losing type safety to
interface{}
?The text was updated successfully, but these errors were encountered: