few improvements of generation xsd for dynamic types with compound properties
-----------------------------------------------------------------------------
Key: TUSCANY-2969
URL: https://issues.apache.org/jira/browse/TUSCANY-2969
Project: Tuscany
Issue Type: Bug
Components: Java SDO Implementation
Affects Versions: Java-SDO-1.1
Reporter: Andrey Utkin
1. There is class cast exception in
org.apache.tuscany.sdo.helper.SchemaBuilder.handleBaseExtn(XSDSchema, Type,
XSDComplexTypeDefinition).
2. Some time generated XSD schema is incomplete.
use case:
1. Define dynamic type with more than one compound properties defined as
dynamic types as well.
2. call XSDHelper.generate(type).
3. Resulting XSD include xs:complexType defs for compound properties. But some
of them may be empty, i.e.:
<xs:complexType abstract="false" name="compound_property_type_name" />
instead of
<xs:complexType abstract="false" name="compound_property_type_name" >
<xs:sequence>
...
</xs:complexType>
It seems that problem is incorrect API usage in
org.apache.tuscany.sdo.helper.SchemaBuilder.buildComplexSchemaType(Type):
Patch to resolve both problems:
Index: SchemaBuilder.java
===================================================================
--- SchemaBuilder.java (revision 149)
+++ SchemaBuilder.java (revision 150)
@@ -338,7 +338,7 @@
complexType.setTargetNamespace(targetNamespace);
complexType.setAbstract(dataType.isAbstract());
- xmlSchema.getTypeDefinitions().add(complexType);
+ //xmlSchema.getTypeDefinitions().add(complexType);
xmlSchema.getContents().add(complexType);
complexType.updateElement();
@@ -730,7 +730,7 @@
}
else
{
-
complexType.setBaseTypeDefinition((XSDSimpleTypeDefinition)typeTable.
+
complexType.setBaseTypeDefinition((XSDComplexTypeDefinition)typeTable.
getXSDTypeDef(baseSchemaType.getNamespaceURI(),baseSchemaType.getLocalPart()));
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.