diff _test/Resources/resources.xsd @ 223:edf011437be8

updated resources schema
author sergey
date Tue, 28 Aug 2012 17:29:42 +0400
parents 84a6382b49c8
children e6c050db7d98
line wrap: on
line diff
--- a/_test/Resources/resources.xsd	Mon Aug 27 17:28:32 2012 +0400
+++ b/_test/Resources/resources.xsd	Tue Aug 28 17:29:42 2012 +0400
@@ -5,17 +5,18 @@
 	<element name="resources">
 		<complexType>
 			<sequence>
-				<element name="root" type="tns:resourceContract" />
-				<element name="typeMap" minOccurs="0">
+				<element name="root" type="tns:ResourceContract" />
+				<element name="contracts" minOccurs="0">
 					<complexType>
 						<sequence>
 							<element name="contract" maxOccurs="unbounded">
 								<complexType>
 									<complexContent>
-										<extension base="tns:resourceContract">
-											<sequence></sequence>
-											<attribute name="type" type="string" use="required">
-											</attribute>
+										<extension base="tns:ResourceContract">
+											<all>
+												<element name="modelType" type="tns:ClassName" />
+											</all>
+											<attribute name="id" type="string" />
 										</extension>
 									</complexContent>
 								</complexType>
@@ -29,7 +30,7 @@
 							<element name="locator" maxOccurs="unbounded">
 								<complexType>
 									<complexContent>
-										<extension base="tns:resourceLocator">
+										<extension base="tns:ResourceLocator">
 											<attribute name="name" type="string" />
 										</extension>
 									</complexContent>
@@ -51,54 +52,74 @@
 	</element>
 
 	<!-- abstract types -->
-	<complexType name="abstractBinding" abstract="true" />
-	<complexType name="abstractTransformation" abstract="true" />
-	<complexType name="abstractResult" abstract="true" />
+	<complexType name="AbstractBinding" abstract="true" />
+	<complexType name="AbstractTransformation" abstract="true" />
+	<complexType name="AbstractResult" abstract="true" />
 
-	<complexType name="resourceContract">
+	<complexType name="ResourceContract">
 		<sequence>
-			<group ref="tns:restOperations"></group>
-			<element name="resource" maxOccurs="unbounded" minOccurs="0">
-				<complexType>
-					<sequence>
-						<element name="contract" type="tns:resourceContract" />
-					</sequence>
-					<attribute name="name" type="string" />
-				</complexType>
-			</element>
+			<group ref="tns:RestOperations" />
+			<element name="resource" maxOccurs="unbounded" minOccurs="0"
+				type="tns:ChildResourceContract" />
 		</sequence>
 	</complexType>
 
-	<group name="restOperations">
+	<complexType name="ChildResourceContract">
 		<sequence>
-			<element name="get" type="tns:operationContract" minOccurs="0" />
-			<element name="post" type="tns:operationContract" minOccurs="0" />
-			<element name="put" type="tns:operationContract" minOccurs="0" />
-			<element name="delete" type="tns:operationContract"
+			<choice>
+				<element name="name" type="string" />
+				<element name="match" type="string" />
+			</choice>
+			<element name="model" minOccurs="0" type="tns:MethodBinding" />
+			<choice>
+				<element name="contract">
+					<complexType>
+						<attribute name="ref" type="string" use="required" />
+					</complexType>
+				</element>
+				<sequence>
+					<group ref="tns:RestOperations" />
+					<element name="resource" type="tns:ChildResourceContract"
+						minOccurs="0" maxOccurs="unbounded" />
+				</sequence>
+			</choice>
+		</sequence>
+
+	</complexType>
+
+	<group name="RestOperations">
+		<sequence>
+			<element name="get" type="tns:OperationContract" minOccurs="0" />
+			<element name="post" type="tns:OperationContract" minOccurs="0" />
+			<element name="put" type="tns:OperationContract" minOccurs="0" />
+			<element name="delete" type="tns:OperationContract"
 				minOccurs="0" />
 		</sequence>
 	</group>
 
-	<complexType name="operationContract">
-		<sequence>
-			<element name="bind" type="tns:methodBinding" />
-			<element name="parameters" type="tns:transformation"
-				minOccurs="0" />
-			<element name="response" type="tns:abstractResult" minOccurs="0" />
-		</sequence>
+	<complexType name="OperationContract">
+		<complexContent>
+			<extension base="tns:MethodBinding">
+				<sequence>
+					<element name="response" type="tns:AbstractResult"
+						minOccurs="0" />
+				</sequence>
+			</extension>
+		</complexContent>
 	</complexType>
 
-	<complexType name="methodBinding">
+	<complexType name="MethodBinding">
 		<sequence>
-			<element name="var" type="tns:bindingVariable" minOccurs="0"
+			<element name="var" type="tns:BindingVariable" minOccurs="0"
 				maxOccurs="unbounded" />
 		</sequence>
-		<attribute name="bind" type="string" use="required" />
+		<attribute name="expr" type="string" use="required" />
+		<attribute name="handler" type="string" />
 	</complexType>
 
-	<complexType name="bindingVariable">
+	<complexType name="BindingVariable">
 		<complexContent>
-			<extension base="tns:methodBinding">
+			<extension base="tns:MethodBinding">
 				<attribute name="name" type="string" />
 			</extension>
 		</complexContent>
@@ -109,15 +130,15 @@
 		<attribute name="class" type="string" />
 	</complexType>
 
-	<complexType name="resourceLocator">
+	<complexType name="ResourceLocator">
 		<sequence>
-			<element name="var" type="tns:bindingVariable" minOccurs="0"
+			<element name="var" type="tns:BindingVariable" minOccurs="0"
 				maxOccurs="unbounded" />
 			<element name="template" type="string" />
 		</sequence>
 	</complexType>
 
-	<simpleType name="redirectCodes">
+	<simpleType name="RedirectCodes">
 		<restriction base="string">
 			<enumeration value="moved-permanently" />
 			<enumeration value="temporary-redirect" />
@@ -125,20 +146,26 @@
 		</restriction>
 	</simpleType>
 
-	<complexType name="redirectResponse">
+	<complexType name="RedirectResponse">
 		<complexContent>
-			<extension base="tns:abstractResult">
+			<extension base="tns:AbstractResult">
 				<choice>
-					<element name="locator" type="tns:resourceLocator" />
+					<element name="locator" type="tns:ResourceLocator" />
 					<element name="locatorRef">
 						<complexType>
 							<attribute name="ref" type="string" />
 						</complexType>
 					</element>
-					<element name="status" type="tns:redirectCodes" minOccurs="0" />
+					<element name="status" type="tns:RedirectCodes" minOccurs="0" />
 				</choice>
 			</extension>
 		</complexContent>
 	</complexType>
 
+	<simpleType name="ClassName">
+		<restriction base="string">
+			<pattern value="\w+(::\w+)*" />
+		</restriction>
+	</simpleType>
+
 </schema>
\ No newline at end of file