-
-
Notifications
You must be signed in to change notification settings - Fork 111
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
Extend the supported data types using types
option
#127
base: master
Are you sure you want to change the base?
Conversation
I don't think this is valid according to JSON schema? JSON doesn't have any "file" type so it seems strange to add it. I might be missing something though, but why not use |
The idea is to use this module to validate response data for any specification that extends json schema. I really like this module and would love to use this for specs like swagger also. This option could be used by any spec that is extending json schema, not only swagger. Adding an option to extend the supported types without changing the existing module is what I am proposing. To answer your question on why I can't use a format file because swagger spec 2 has defined file as a type rather than a format. |
@LinusU - sorry to bug you with this, however any update on this? |
@LinusU any idea, if this PR would be accepted? |
Ultimately, it's up to mafintosh, but I think that the developers has misunderstood how json-schema works. I would really like to see a discussion with the Swagger people on why they chose to do this, because to me it seems wrong, and as far as I know, they aren't following the json schema specification. For these reasons I'm not a big fan of merging this, I hope you can understand my point of view... |
Completely understand, why you have concerns supporting this. Agree that, Swagger should not have deviated from the json schema to define a type like |
It would probably be quite easy to make a small function that "fixes" the schema before passing it to is-my-json-valid though. Look for |
It would be really cool to provide an option to extend the default and supported
types
.This
types
option can be an easy fix/feature for anyone wanting to extend capabilities of the validator to - either define custom types for schema or trying to extend features of the existing validations.One example of such a use case, would be
Swagger
file
type.