Loading multiple schemas is order dependent
masaeedu opened this issue · 0 comments
masaeedu commented
When a directory containing two xsd
files is passed like so:
java -jar ./jsonix-schema-compiler-full-2.3.9.jar -generateJsonSchema -p PO -d /foo /foo
The schema compiler seems to load the files in an arbitrary order, without regard to the imports within the files. This results in errors when resolving namespaced items:
root@6cf62e9c0475:/# java -jar ./jsonix-schema-compiler-full-2.3.9.jar -generateJsonSchema -p PO /foo/
[ERROR] src-resolve: Cannot resolve the name 'xs:schema' to a(n) 'element declaration' component.
line 36 of file:/foo/schema0.xsd
[ERROR] src-resolve: Cannot resolve the name 'q1:RestoreOptions' to a(n) 'type definition' component.
line 1103 of file:/foo/schema0.xsd
[ERROR] org.hisrc.jsonix.execution.JsonixInvoker - The model is null, there was probably a problem parsing schemas.
The correct order needs to be specified manually on the command line:
java -jar ./jsonix-schema-compiler-full-2.3.9.jar -generateJsonSchema -p PO /foo/schema1.xsd /foo/schema0.xsd
It would be useful if the CLI/schema generator would examine the root element namespaces and imports within the schemas to automatically work out the correct order.