- in studio create 1 or 2 files of type directory
- click Edit and add a directory reference like continent or nature
- save the schema
- download the project
- check the xsd file of the schema inside the project archive, the directory reference is there but the type is String:
<xs:element name="test1"> <xs:simpleType> <xs:restriction base="xs:string" ref:resolver="directoryResolver" ref:directory="continent"/> </xs:simpleType> </xs:element> <xs:element name="test2"> <xs:simpleType> <xs:restriction base="xs:string" ref:resolver="directoryResolver" ref:directory="nature"/> </xs:simpleType> </xs:element>
- Open the file in an editor
- modify the element names to test3 and test4 instead of test1 and test2.
- save the file with a different name
- in Studio, import the file with New / Initialize and select the file
- Observe the fields are now of type String and the directory references are lost
This can actually be reproduced with any kind of constraint: Studio does not handle them during init at this stage.
TODO
- Handle constraints in schema creation with initialize option
AC
- When importing a schema that contains valid constraints, these constraints are added to the schema and the field type matches the declaration (e.g. it becomes a directory if a directory is referenced)
- When importing a schema that contains INVALID constraints (e.g. try to set a min / max amount on a string field)
- These constraints are ignored (if possible, otherwise import can also show an empty schema like it is the case currently).
- A message is shown to the user:
Your schema could not be imported [entirely - if partial import can be done] due to errors in its content.
[If possible show errors] - Values are not checked, but only constraints validity: for instance we should not check if a directory exists because it can be created/deployed outside of studio.