-
-
Notifications
You must be signed in to change notification settings - Fork 63
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
fix: move RenameDuplicateAttributes to before SanitizeAttributesDefaultValue in Steps.SANITIZE #806
Conversation
yeah... breaks the expectations set in for example (from #805): from dataclasses import dataclass, field
from enum import Enum
class UnitsPower(Enum):
MW = "MW"
M_W_1 = "mW"
@dataclass
class LightSource:
power_unit: UnitsPower = field(
default=UnitsPower.M_W,
metadata={
"name": "PowerUnit",
"type": "Attribute",
}
) should I be trying to convert the enum |
a little more debugging... after [
Class(
qname='UnitsPower',
attrs=[
Attr(
tag='Enumeration',
name='MW',
local_name='MW',
...
),
Attr(
tag='Enumeration',
name='mW_1',
local_name='mW', but the Class(
qname='LightSource',
attrs=[
Attr(
tag='Attribute',
name='PowerUnit',
local_name='PowerUnit',
default='@enum@UnitsPower::mW', ... edit xsdata/xsdata/codegen/container.py Lines 117 to 126 in 11dbca8
the field defaults get applied during step |
Kudos, SonarCloud Quality Gate passed!
|
moving tests are all passing but let me know if maybe I'm missing some unexpected side effect here. The code output by my test case is now correct: class UnitsPower(Enum):
MW = "MW"
M_W_1 = "mW"
@dataclass
class LightSource:
power_unit: UnitsPower = field(
default=UnitsPower.M_W_1,
metadata={
"name": "PowerUnit",
"type": "Attribute",
}
) |
Codecov ReportPatch and project coverage have no change.
Additional details and impacted files@@ Coverage Diff @@
## master #806 +/- ##
=======================================
Coverage 99.96% 99.96%
=======================================
Files 104 104
Lines 9244 9244
Branches 2067 2067
=======================================
Hits 9241 9241
Partials 3 3
☔ View full report in Codecov by Sentry. |
happy to add a test for this if you tell me at what level it should be tested (i.e. full fixture or low level unit) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent troubleshoot!!!
12k w3c tests and the sample suite all checked out. |
📒 Description
This fixes #805, an issue with enums with conflicting slugs
🔗 What I've Done
💬 Comments
While this fixes the problem i described... i have no idea what else it will break, so letting the tests run, and we can discuss
🛫 Checklist