-
Notifications
You must be signed in to change notification settings - Fork 51
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
Schema Enums not interpreted correcly #28
Comments
A sample JSON to parse would be: |
Oh and to be said, this project is awesome. Thanks for your work! |
If the enum only contained numbers we could have just generated the enum with the attribute from https://github.com/dtolnay/serde-repr . But since there are both integers and strings that won't work, and neither will annotating the number variants with This probably requires us to generate a fully custom implementation of A simpler but more manual approach could be to let users specify a set of types for which |
That would absolutely be a solution. Can this be done already? |
No, none of these approaches are implemented atm though any would be acceptable. I am not actively working on this crate either so if it is something you need I am afraid you will need to implement it yourself (or use something else). |
I see, if I succeed (I am very new to rust, so it is unlikely) I will create a PR. |
Example schema:
"https://raw.githubusercontent.com/EDSM-NET/EDDN/master/schemas/commodity-v3.0.json"
Problem:
levelType ist defined as:
Now panics with:
I tried to fix that like that but did not succeed.
This compiles and generates a Commodity struct but not a correct one.
The text was updated successfully, but these errors were encountered: