Generate wrapper
📒 Description
Adds new feature to code generation to detect wrapped lists and unwrap them in dataclasses, using the wrapped feature.
Resolves #927
🔗 What I've Done
- Added an output config option to unwrap wrapped lists.
- Added an attribute to Attr for
wrapper, indicating the wrapper element name. - Added a processor in Translate (Flatten) which
- places the list wrapper's
local_nameinto thewrapperof the wrapped list - optionally changes the name of the wrapped list to match the wrapper
- replaces the wrapper attribute with the wrapped attribute
- replaces the
innerfor the wrapper with theinnerfor the wrapped
- places the list wrapper's
💬 Comments
This is currently in draft and needs unit tests / doc changes etc.
Am creating this as a draft now to allow @tefra to comment on the approach, before I work on documentation and unit tests.
One major decision here was whether code should be trigged through the ClassContainer or should be entirely encoded into the dataclass writer. On balance it seemed simpler to embed this and unit test this in the ClassContainer.
🛫 Checklist
- [ ] Updated docs
- [ ] Added unit-tests
- [ ] Sample tests pass
- [ ] W3C tests pass
Quality Gate passed
The SonarCloud Quality Gate passed, but some issues were introduced.
1 New issue
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code
This is on my immediate todo list, I will close this one for now