Skip to content

Commit

Permalink
Integrate schema support of type binding for "object", re #53
Browse files Browse the repository at this point in the history
  • Loading branch information
safris committed Oct 19, 2023
1 parent e5fa3b6 commit dc389ab
Show file tree
Hide file tree
Showing 3 changed files with 386 additions and 363 deletions.
41 changes: 23 additions & 18 deletions schema-0.5/binding-0.5.jsd
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,25 @@
}
}
},
"typeBinding": {
"typeFieldBinding": {
"@": "object",
"@doc": "Specifies language-specific binding.",
"@extends": "fieldBinding",
"@properties": {
"@type": {
"@": "reference",
"@doc": "Specifies the \"type\" qualified identifier.",
"@nullable": false,
"@type": "typeIdentifier",
"@use": "optional"
},
}
}
},
"codecTypeFieldBinding": {
"@": "object",
"@doc": "Specifies language-specific binding.",
"@extends": "typeFieldBinding",
"@properties": {
"@decode": {
"@": "reference",
"@doc": "Specifies the \"decode\" qualified function identifier that accepts input as a string, or as the native JSON type of this property, and returns an output of the specified \"type\" (or the default type if \"type\" is unspecified).",
Expand All @@ -58,39 +66,36 @@
}
}
},
"typeFieldBinding": {
"fieldBindings": {
"@": "object",
"@doc": "Specifies language-specific binding.",
"@extends": "typeBinding",
"@abstract": true,
"@properties": {
"@field": {
"@": "reference",
"@doc": "Specifies the \"field\" identifier.",
"\\S|\\S.*\\S": {
"@": "any",
"@nullable": false,
"@type": "fieldIdentifier",
"@use": "optional"
"@types": "fieldBinding"
}
}
},
"fieldBindings": {
"typeFieldBindings": {
"@": "object",
"@abstract": true,
"@properties": {
"\\S|\\S.*\\S": {
"@": "any",
"@nullable": false,
"@types": "fieldBinding"
"@types": "typeFieldBinding"
}
}
},
"typeFieldBindings": {
"codecTypeFieldBindings": {
"@": "object",
"@abstract": true,
"@properties": {
"\\S|\\S.*\\S": {
"@": "any",
"@nullable": false,
"@types": "typeFieldBinding"
"@types": "codecTypeFieldBinding"
}
}
},
Expand Down Expand Up @@ -129,7 +134,7 @@
},
"object": {
"@": "object",
"@extends": "fieldBindings",
"@extends": "typeFieldBindings",
"@properties": {
"@": {
"@": "string",
Expand All @@ -140,7 +145,7 @@
},
"boolean": {
"@": "object",
"@extends": "typeFieldBindings",
"@extends": "codecTypeFieldBindings",
"@properties": {
"@": {
"@": "string",
Expand All @@ -151,7 +156,7 @@
},
"number": {
"@": "object",
"@extends": "typeFieldBindings",
"@extends": "codecTypeFieldBindings",
"@properties": {
"@": {
"@": "string",
Expand All @@ -162,7 +167,7 @@
},
"string": {
"@": "object",
"@extends": "typeFieldBindings",
"@extends": "codecTypeFieldBindings",
"@properties": {
"@": {
"@": "string",
Expand Down
21 changes: 12 additions & 9 deletions schema-0.5/binding-0.5.jsdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,14 @@
<property name="@field" xsi:type="reference" type="fieldIdentifier" use="optional" nullable="false" doc="Specifies the &quot;field&quot; identifier."/>
</object>

<object name="typeBinding" doc="Specifies language-specific binding.">
<object name="typeFieldBinding" extends="fieldBinding" doc="Specifies language-specific binding.">
<property name="@type" xsi:type="reference" type="typeIdentifier" use="optional" nullable="false" doc="Specifies the &quot;type&quot; qualified identifier."/>
<property name="@decode" xsi:type="reference" type="methodIdentifier" use="optional" nullable="false" doc="Specifies the &quot;decode&quot; qualified function identifier that accepts input as a string, or as the native JSON type of this property, and returns an output of the specified &quot;type&quot; (or the default type if &quot;type&quot; is unspecified)."/>
<property name="@encode" xsi:type="reference" type="methodIdentifier" use="optional" nullable="false" doc="Specifies the &quot;encode&quot; qualified function identifier that accepts input of the type specified in &quot;type&quot; (or the default type if &quot;type&quot; is unspecified), and returns an output as a string, or as the native JSON type of this property."/>
</object>

<object name="typeFieldBinding" extends="typeBinding" doc="Specifies language-specific binding.">
<object name="codecTypeFieldBinding" extends="typeFieldBinding" doc="Specifies language-specific binding.">
<property name="@decode" xsi:type="reference" type="methodIdentifier" use="optional" nullable="false" doc="Specifies the &quot;decode&quot; qualified function identifier that accepts input as a string, or as the native JSON type of this property, and returns an output of the specified &quot;type&quot; (or the default type if &quot;type&quot; is unspecified)."/>
<property name="@encode" xsi:type="reference" type="methodIdentifier" use="optional" nullable="false" doc="Specifies the &quot;encode&quot; qualified function identifier that accepts input of the type specified in &quot;type&quot; (or the default type if &quot;type&quot; is unspecified), and returns an output as a string, or as the native JSON type of this property."/>
<!-- FIXME: Equivalent of <xs:assert test="some $path in ../@path satisfies not(@field) or count(tokenize($path, '([^\\]|\\\\)\[')) = 1 and count(tokenize($path, '([^\\]|\\\\)\.')) > 1"/> is not yet possible in JSDx -->
<property name="@field" xsi:type="reference" type="fieldIdentifier" use="optional" nullable="false" doc="Specifies the &quot;field&quot; identifier."/>
</object>

<object name="fieldBindings" abstract="true">
Expand All @@ -56,6 +55,10 @@
<property names="\S|\S.*\S" xsi:type="any" types="typeFieldBinding" nullable="false"/>
</object>

<object name="codecTypeFieldBindings" abstract="true">
<property names="\S|\S.*\S" xsi:type="any" types="codecTypeFieldBinding" nullable="false"/>
</object>

<object name="any" extends="fieldBindings">
<property name="@" xsi:type="string" pattern="any" nullable="false"/>
</object>
Expand All @@ -68,19 +71,19 @@
<property name="@" xsi:type="string" pattern="array" nullable="false"/>
</object>

<object name="object" extends="fieldBindings">
<object name="object" extends="typeFieldBindings">
<property name="@" xsi:type="string" pattern="object" nullable="false"/>
</object>

<object name="boolean" extends="typeFieldBindings">
<object name="boolean" extends="codecTypeFieldBindings">
<property name="@" xsi:type="string" pattern="boolean" nullable="false"/>
</object>

<object name="number" extends="typeFieldBindings">
<object name="number" extends="codecTypeFieldBindings">
<property name="@" xsi:type="string" pattern="number" nullable="false"/>
</object>

<object name="string" extends="typeFieldBindings">
<object name="string" extends="codecTypeFieldBindings">
<property name="@" xsi:type="string" pattern="string" nullable="false"/>
</object>

Expand Down
Loading

0 comments on commit dc389ab

Please sign in to comment.