-
-
Notifications
You must be signed in to change notification settings - Fork 66
Typing issues #466
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
Comments
Thanks for reporing @neriusmika Yeah the first one is pretty straightforward and you are correct the keys and values are always str. In the base class the element is effectively a list where in the subclass the element has effectively <xsd:complexType name="GenericTimeStampType" abstract="true">
<xsd:sequence>
...
<xsd:choice maxOccurs="unbounded"><!-- maxOccurs > 1 aka list -->
<xsd:element name="EncapsulatedTimeStamp" type="EncapsulatedPKIDataType"/>
<xsd:element name="XMLTimeStamp" type="AnyType"/>
</xsd:choice>
</xsd:sequence>
...
...
<xsd:complexType name="OtherTimeStampType">
<xsd:complexContent>
<xsd:restriction base="GenericTimeStampType">
<xsd:sequence>
...
...
<xsd:choice> <!-- maxOccurs=1 -->
<xsd:element name="EncapsulatedTimeStamp" type="EncapsulatedPKIDataType"/>
<xsd:element name="XMLTimeStamp" type="AnyType"/>
</xsd:choice>
</xsd:sequence> One way would be to simply keep the element as a list in the subclass, xjc (java) completely ignores the subclass fields by simple generating an empty class extending the base class. I ''ll have to think about it and run a few tests. |
Yes, these rare cases with restrictions smell. My intuition says, that making a whole new python class without inheritance will cause fewer problems. Of course, you can't reuse code from the base class, but doing so would be dangerous anyway. Liskov violation etc. |
Hi @neriusmika Thanks for reporting, this issue triggered a series of some very important updates 🚀 I have added the UBL collection in the samples repo it now passes all mypy checks. |
Good news, thank you 👏 |
With UBL schemas, I found 2 problems in file common\ubl_xad_esv132_2_1.py:
Dict
type in a strict mode:XML attributes are always strings, can we change that type hint to
Dict[str, str]
?OtherTimeStampType.encapsulated_time_stamp
is different from the base class.The text was updated successfully, but these errors were encountered: