You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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_field method, 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?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
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...
I would like to know:
CreateWrapperFields.wrap_fieldmethod, but I don't know if that's a good idea and wonder if there is a better way?Thanks!
Beta Was this translation helpful? Give feedback.
All reactions