-
Notifications
You must be signed in to change notification settings - Fork 202
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
fix: typeof function #1182
fix: typeof function #1182
Conversation
d894130
to
aaed428
Compare
153d144
to
15b4770
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we had requests for supporting functions before. Please search the issues and prs.
in general, I'm not sure I want to support functions since json schema doesn't support them. Maybe the cleaner way is to just ignore functions entirely?
You are right I think they should just be ignored, but failing is not a good option |
I did update to return an |
Remind me, is $comment standard? Should we add not: {} to indicate that the property should not be set? |
The $comment seems a standard to JSONSchema7: http://json-schema.org/draft-07/schema properties.$comment
That was the first behavior to add a |
I think I would prefer no comment in the schema and instead a warning. JSON schema does not support functions and therefore we should not attempt to make them work. |
I think adding a
With the available override capabilities, we can either just document how to code each behavior |
I like the idea of documenting how to implement the behaviors. How about we implement ignore as the default? |
Sounds good to me |
The 'Unknown type "function"' error is going to be pretty common. This is just one of those differences between TS and JSON that is inherent to this problem space. But the current behavior is pretty atrocious. Schema generation fails completely, and you get a really terse error message that has zero information about where the error occurred (The type name and property that triggered the problem is not supplied), and zero information about how to resolve the problem. Developers are forced to sift through the issues for a solution. This takes you down the rabbit hole of having to write a custom generator, which is also not particularly well documented. (This is where I'm at right now, trying to figure out what exactly my generator code needs to look like and having some issues with that, unfortunately.) I would much rather there were a simple way of indicating how unknown types should be handled as suggested in this issue. E.g. A config option along the lines of... "unknownTypes": {
"function": "ignore",
// ...
} |
🚀 PR was released in |
I still faced the following error in v1.1.2:
Do I need to add any config to ignore function type? EDITED: |
Confirming this issue is still present in v1.2.0 |
Fix issue #1181