-
Notifications
You must be signed in to change notification settings - Fork 82
Open
Labels
please contributeA PR is welcome for this issue. Please target the `development` branch.A PR is welcome for this issue. Please target the `development` branch.schemaIssues that impact the schema fileIssues that impact the schema file
Milestone
Description
Let's say I want the value of a length property to be exactly 2.0. I would use <simpleValue>, but it technically only accepts strings.
ids.xsd#L41:
<xs:element name="simpleValue" type="xs:string" minOccurs="1" maxOccurs="1"/>
When I try to convert python data to IDS using xml.etree Python package, it says:
File "...\site-packages\xmlschema\validators\xsdbase.py", line 249, in validation_error raise error
xmlschema.validators.exceptions.XMLSchemaEncodeError: failed validating 2.0 with XsdAtomicBuiltin(name='xs:string'):
Reason: 2.0 is not an instance of <class 'str'>
So the implementers have to remember to cast all alphanumeric values to strings. I think we could improve the schema by replacing the abovementioned line with union type also allowing numbers:
<xs:element name="simpleValue" minOccurs="1" maxOccurs="1">
<xs:simpleType>
<xs:union memberTypes="xs:string xs:decimal xs:int"/>
</xs:simpleType>
</xs:element>
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
please contributeA PR is welcome for this issue. Please target the `development` branch.A PR is welcome for this issue. Please target the `development` branch.schemaIssues that impact the schema fileIssues that impact the schema file
Type
Projects
Status
Todo