-
-
Notifications
You must be signed in to change notification settings - Fork 79
-
Hello, I've been doing a deep dive into xsdata recently to assess its suitability for a project that I am working on. I think it looks like a wonderful library, thank you and well done!
I have some questions regarding wrapped lists and how the list's attribute is named on the generated dataclass. Questions are at the bottom after some introduction:
-
On the Wrapped List documentation page it implies that the attribute should be named after the wrapper element - "Books" in this case.
-
On the wrapperfields config documentation it shows that the attribute will be named after the wrapped element - "alpha", "bravo", "charlie" (singular). This is the implemented behaviour.
I think I prefer the first approach - partly because it feels more intuitive that the list attribute should have the plural name from the wrapped element, but also because it would make this document structure possible...
<Library> <BestBooks> <Title>python for beginners</Title> <Title>beautiful xml</Title> </BestBooks> <WorstBooks> <Title>python for nobody</Title> <Title>horrible xml</Title> </WorstBooks> </Library>
I would like to know:
- is the current behaviour based on a principled decision, or an accident of implementation?
- I think I can get my preferred behaviour through monkeypatching the
CreateWrapperFields.wrap_fieldmethod, but I don't know if that's a good idea and wonder if there is a better way? - what would you think about making this configurable?
Thanks!
Beta Was this translation helpful? Give feedback.