-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
Feature Request: Add option to infer wrapped lists when generating python code from XSD #927
Comments
It should be part of the code generator, I agree. |
If I was to look at the possible code for this would it be better to process this in the transform step (which would need a |
I've not forgotten this. Just ran out of free time. I'll be back ;-) |
This is on my immediate todo list @couling |
@couling are you working with a specific schema? |
I am. But sadly it's proprietary and I don't have authorisation to share it. |
I added a new cli config option This is what it does on the w3c-test suite. Give it a try and let me know how it works for your use case @couling |
Wrapped lists are really useful for simplifying python data structures. Looking through the documentation, I don't see any way to make this work with
xsdata generate <xsd file>
.It would be really useful to have an option to infer wrapped lists where one data class will contain another dataclass, itself only containing a list. This may be something that can be post-processed between schema transformation and python code writer.
I don't see any documentation on the "Pluggable code writer for custom output formats". So this customisation isn't something that can be easily bolted on from the side.
I certainly don't want to manually modify python code after parsing a sizeable XSD where the XSD is subject to change.
It could be optional which name is kept for the python name, but I'd recommend it default to the wrapper name, not the element name for these reasons:
Eg:
most naturally converts to
It makes much less sense to convert this to
Person(child=["bob"])
The text was updated successfully, but these errors were encountered: