Closed dsfaccini closed 5 months ago
Ok I've encountered a case where the field type is correctly wrapped in quotes, but the name of the field is the same as a subclass defined inside the class and that is just not something the library should be responsible for, so I'm closing my issue.
An example to illustrate here
Best David
Hi @tefra,
Working on this same project I wanted to use originalCase for both the Class names and the Field names. The reason is, I already have a partial code base using the original names (in
PascalCase
) and mapping these existing functions to generatedsnake_case
Class and Field names is a whole chore.So I modified the xsdata init-config file to preserve the case and I got a recursion error on the last step of generation.
Based on ./generation.log lines 70 to 145, I'm guessing the recursion error comes from a field name referencing itself in its type. If that's the case this should be easily fixable.
You can try it by cloning this repo and running the generate script.
Potential underlying issue
Also, if you look at the generated module you'll see the following on line 259
This messes up Pylance/Pyright, since it recognizes this as the field referencing itself.
Variable not allowed in type expression *Pylance*(reportInvalidTypeForm)
The correct generation in those cases should beLet me know if you'd like me to put up a pull request to adjust this behavior! It would be helpful in that case if you could nudge me a bit on what file/s to look into.
Best regards, David