-
-
Notifications
You must be signed in to change notification settings - Fork 147
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
JsonSchema.GenerateCode fails with "This schema is not in a supported form." with no additional details #523
Comments
Hello. Please read the documentation to see what's supported. The system validates your schema with some schemas of it's own to make sure that it's supported. The validation results should be in the I say "should," but it doesn't look like I actually did that that. I can add it. |
Looking at your schema, the |
Thanks for the quick response? Can we include a textual representation of the validation errors as part of the exception message? That will provide immediate feedback to the next user :-) |
Sorry, that would require a certain level of analysis of the results that we (JSON Schema) haven't figured out. The best bet would be to give you the results and publish the schemas I'm using internally. |
I don't follow. According to the docs, one of the output formats is List, which is just a list of errors. Is it not possible to concat those errors (along with their location path)? |
The problem is that there are potentially a lot of errors that could appear and not all of them are super useful for any particular case, especially since the schema's I'm using are coordinated by a See also this discussion. The best option is for me to just put the validation results directly in the exception, and let you debug. |
I'll also add some more technical documentation regarding what's supported. |
Please see https://docs.json-everything.net/schema/codegen/patterns/. I've not yet updated the library. |
OK, I've copied out the schema being used for validation so I could output the errors, and I see what you mean about the output. To give more context, I'm evaluating this library to generate C# model classes from our existing schema. We're currently (partially) using NJsonSchema, but it is missing some features we need and doesn't seems to be actively maintained (cf RicoSuter/NJsonSchema#1605 ). Unfortunately, the full schema is 300 lines and I'm currently getting 400 errors. I spent 10 minutes looking through the errors to the find out the actual cause but had no success. My suggestion here would be to add a custom property (eg "x-json-everything-oneof-disambiguator": "type"), which would just mark one error if the type property is missing, or use it to pick which oneof schema to verify. |
I'm not sure what you mean here. Where does this property go? How would it help? If you want to send me your output, you can do so in a DM in Slack. There's a link in the readme. |
Ugh... typos thwarting automation! Anyway, I've added the validation results to the exception, and docs detailing the schemas I'm using should be up soon. |
Nuget Package
JsonSchema.Net.CodeGeneration
Package Version
0.1.1
Operating System
Windows
.Net Target (if relevant, please specify the version in the description)
.Net Framework
A clear and concise description of the bug
I'm evaluating using JsonSchema.Net.CodeGeneration for code generation, but it is failing with this exception:
Please add test code or steps to reproduce the behavior
This is an example failing schema, but that it is failing isn't the main issue, it's the fact that the exception doesn't give any details as to why it has failed.
What did you expect?
A specific exception message with details to the failure
Is there any other information you'd like to share regarding this bug?
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: