Skip to content
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

Include empty namespace types from multiple target namespaces #172

Closed
tefra opened this issue May 18, 2020 · 1 comment
Closed

Include empty namespace types from multiple target namespaces #172

tefra opened this issue May 18, 2020 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@tefra
Copy link
Owner

tefra commented May 18, 2020

Based on this https://www.w3.org/TR/xmlschema-1/#element-include

The ·XML Schema· corresponding to contains not only the components corresponding to its definition and declaration [children], but also all the components of all the ·XML Schemas· corresponding to any d schema documents. Such included schema documents must either (a) have the same targetNamespace as the ing schema document, or (b) no targetNamespace at all, in which case the d schema document is converted to the ing schema document's targetNamespace.

xsdata is using the above directive to assign the source namespace that a type was defined. Also every schema is only processed once. During import by directory the following scenario results in a conflict when the analyzer tries to locate a specific type.

Scenario:

a.xsd with target namespace foo includes schema c.xsd with no target namespace. This converts all schema c.xsd types to the parent namespace foo

in the same run another schema

b.xsd with target namespace bar includes schema c.xsd with no target namespace. Since schema c.xsd has been already processed the cli will skip it and the analyze process for the b.xsd types will only look by default in the bar namespace to locate types from c.xsd but they have already been assign to another source namespace.

Thus the analyzer finder methods will miss the real classes issue a warning Missing type or Missing extension and reset the real type to xs:string

Solutions:

  • Raise an exception early if this is detected
  • Add documentation for people to use the cli directory option with caution
  • Far fetched stop relying on the source namespace to locate types
@tefra tefra added the documentation Improvements or additions to documentation label May 23, 2020
@tefra
Copy link
Owner Author

tefra commented Jun 11, 2020

The only realistic solution is to stop allowing process of multiple sources, to allow only one file or one uri or one directory at a time.

I hope this doesn't affect anyone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant