-
-
Notifications
You must be signed in to change notification settings - Fork 60
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
add custom mixin classes #732
Comments
Something like an output configuration something like this? <Modifications>
<Class qualname="generated.models.AddressList">
<AddBaseClass qualname="custom.mixins.MyAddressList"/>
</Class>
</Modifications> |
We would be interested in this too, like to plug custom Python validators... BTW, may be I did it wrong, but in my xsdata-odoo plugin (inspired from your xsdata-plantuml plugin, I tried to have custom configuration options and that didn't seem easy because from what I remember it would load the default GeneratorConfig class before even loading my plugin and in GeneratorConfig the attributes seem fixed. So if you touch the GeneratorConfig and have some idea to make this easier... |
Or maybe just configure a python module name, enumerate over the classes in that module and use |
Hey @leo-b I added the ability to extend generated models with base classes and custom decorators The update is on master wave |
Hi!
First of all thanks for providing such cool XML bindings!
Generating code using python dataclasses really produces the most beautiful and clearly arranged representations of my bloated XML structures.
In my project I'd like to enrich the data container object hierarchy generated by xsdata (which is based on a externally provided xsd schema) by my own methods that add some custom logic.
My idea is to extend the dataclass output by automatically adding mixin classes from a custom module that is specified during model generation.
Those custom classes should be automatically added to my generated dataclasses as additional base classes.
Do you think this could make sense and would be possible with reasonable effort?
Could you give some hints how to implement this? Are class extensions the correct place to add the mixins?
Example:
Cheers,
--leo
The text was updated successfully, but these errors were encountered: