Skip to content

Commit

Permalink
Merge pull request #1360 from aml-org/W-10881268-allOf-resolution-stage
Browse files Browse the repository at this point in the history
W-10881268 - Changed tranformer to use allOf and oneOf instead of inh…
  • Loading branch information
looseale authored Mar 29, 2022
2 parents 9dbddae + 68a1fa2 commit d37b309
Show file tree
Hide file tree
Showing 23 changed files with 633 additions and 158 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#%Dialect 1.0
nodeMappings:
allOf-Complex:
allOf:
- SchemaNode
- SchemaNode_1
- SchemaNode_5
- extension_allOf-Complex
extension_allOf-Complex:
mapping:
d:
range: number
mandatory: true
additionalProperties: true
SchemaNode:
mapping:
a:
range: string
mandatory: false
additionalProperties: true
SchemaNode_1:
conditional:
if: SchemaNode_2
then: SchemaNode_3
else: SchemaNode_4
SchemaNode_2:
mapping:
a:
range: any
mandatory: false
enum:
- condition
additionalProperties: true
SchemaNode_3:
mapping:
a:
range: string
propertyTerm: config.sensitive
mandatory: false
additionalProperties: true
SchemaNode_4:
mapping:
a:
range: string
propertyTerm: config.dataweaveExpression
mandatory: false
additionalProperties: true
SchemaNode_5:
oneOf:
- SchemaNode_6
- SchemaNode_7
SchemaNode_6:
mapping:
b:
range: integer
mandatory: false
additionalProperties: true
SchemaNode_7:
mapping:
c:
range: boolean
mandatory: false
additionalProperties: true
external:
config: anypoint://vocabulary/policy.yaml#
ns0: http://test.com/vocab#
dialect: amf-json-schema-generated-dialect
version: "1.0"
documents:
root:
encodes: allOf-Complex
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,12 @@
"doc:DomainElement"
],
"core:name": "Child",
"doc:extends": [
"http://a.ml/vocabularies/amf/aml#and": [
{
"@id": "#/declarations/Child/null"
"@id": "#/declarations/SchemaNode"
},
{
"@id": "#/declarations/Child/null"
"@id": "#/declarations/extension_Child"
}
]
},
Expand Down Expand Up @@ -174,20 +174,6 @@
],
"shacl:minCount": 0
},
{
"@id": "#/declarations/Child/null",
"@type": [
"meta:NodeMapping",
"shacl:Shape",
"doc:DomainElement"
],
"doc:link-target": [
{
"@id": "#/declarations/SchemaNode"
}
],
"doc:link-label": "SchemaNode"
},
{
"@id": "/property/property/name",
"@type": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#%Dialect 1.0
nodeMappings:
Child:
extends:
allOf:
- SchemaNode
- extension_Child
extension_Child:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,18 +118,18 @@
"doc:DomainElement"
],
"core:name": "Child",
"doc:extends": [
"http://a.ml/vocabularies/amf/aml#and": [
{
"@id": "#/declarations/Child/null"
"@id": "#/declarations/SchemaNode"
},
{
"@id": "#/declarations/Child/null"
"@id": "#/declarations/SchemaNode_1"
},
{
"@id": "#/declarations/Child/null"
"@id": "#/declarations/SchemaNode_2"
},
{
"@id": "#/declarations/Child/null"
"@id": "#/declarations/extension_Child"
}
]
},
Expand Down Expand Up @@ -191,20 +191,6 @@
],
"shacl:minCount": 0
},
{
"@id": "#/declarations/Child/null",
"@type": [
"meta:NodeMapping",
"shacl:Shape",
"doc:DomainElement"
],
"doc:link-target": [
{
"@id": "#/declarations/SchemaNode"
}
],
"doc:link-label": "SchemaNode"
},
{
"@id": "/and/shape/item1/property/property/b",
"@type": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#%Dialect 1.0
nodeMappings:
Child:
extends:
allOf:
- SchemaNode
- SchemaNode_1
- SchemaNode_2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,15 @@
"doc:DomainElement"
],
"core:name": "Child",
"doc:extends": [
"http://a.ml/vocabularies/amf/aml#and": [
{
"@id": "#/declarations/Child/null"
"@id": "#/declarations/SchemaNode"
},
{
"@id": "#/declarations/Child/null"
"@id": "#/declarations/SchemaNode_1"
},
{
"@id": "#/declarations/Child/null"
"@id": "#/declarations/SchemaNode_2"
}
]
},
Expand Down Expand Up @@ -170,20 +170,6 @@
],
"shacl:minCount": 0
},
{
"@id": "#/declarations/Child/null",
"@type": [
"meta:NodeMapping",
"shacl:Shape",
"doc:DomainElement"
],
"doc:link-target": [
{
"@id": "#/declarations/SchemaNode"
}
],
"doc:link-label": "SchemaNode"
},
{
"@id": "/and/shape/item1/property/property/b",
"@type": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#%Dialect 1.0
nodeMappings:
Child:
extends:
allOf:
- SchemaNode
- SchemaNode_1
- SchemaNode_2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,12 @@
"doc:DomainElement"
],
"core:name": "SomePolicy",
"doc:extends": [
"http://a.ml/vocabularies/amf/aml#and": [
{
"@id": "#/declarations/SomePolicy/null"
"@id": "#/declarations/SchemaNode"
},
{
"@id": "#/declarations/SomePolicy/null"
"@id": "#/declarations/extension_SomePolicy"
}
]
},
Expand Down Expand Up @@ -253,20 +253,6 @@
"@id": "/and/any/item0/shape/if/property/property/logStatistics/list"
}
},
{
"@id": "#/declarations/SomePolicy/null",
"@type": [
"meta:ConditionalNodeMapping",
"shacl:Shape",
"doc:DomainElement"
],
"doc:link-target": [
{
"@id": "#/declarations/SchemaNode"
}
],
"doc:link-label": "SchemaNode"
},
{
"@id": "/property/property/thisApiName",
"@type": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#%Dialect 1.0
nodeMappings:
SomePolicy:
extends:
allOf:
- SchemaNode
- extension_SomePolicy
extension_SomePolicy:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,19 @@
{
"@id": "#/declarations/Child",
"@type": [
"meta:UnionNodeMapping",
"meta:NodeMapping",
"shacl:Shape",
"doc:DomainElement"
],
"core:name": "Child",
"shacl:node": {
"@id": "#/declarations/Child/list"
}
"http://a.ml/vocabularies/amf/aml#or": [
{
"@id": "#/declarations/SchemaNode"
},
{
"@id": "#/declarations/SchemaNode_1"
}
]
},
{
"@id": "#/declarations/SchemaNode_1",
Expand Down Expand Up @@ -145,16 +150,6 @@
],
"shacl:minCount": 0
},
{
"@id": "#/declarations/Child/list",
"@type": "rdfs:Seq",
"rdfs:_1": {
"@id": "#/declarations/SchemaNode"
},
"rdfs:_2": {
"@id": "#/declarations/SchemaNode_1"
}
},
{
"@id": "/exclusiveOr/shape/item1/property/property/address",
"@type": [
Expand All @@ -178,7 +173,6 @@
"@context": {
"@base": "file://amf-cli/shared/src/test/resources/semantic-jsonschema/json-schemas/oneOf-custom.json",
"shacl": "http://www.w3.org/ns/shacl#",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"doc": "http://a.ml/vocabularies/document#",
"core": "http://a.ml/vocabularies/core#",
"owl": "http://www.w3.org/2002/07/owl#",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#%Dialect 1.0
nodeMappings:
Child:
union:
oneOf:
- SchemaNode
- SchemaNode_1
SchemaNode_1:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,22 @@
{
"@id": "#/declarations/Child",
"@type": [
"meta:UnionNodeMapping",
"meta:NodeMapping",
"shacl:Shape",
"doc:DomainElement"
],
"core:name": "Child",
"shacl:node": {
"@id": "#/declarations/Child/list"
}
"http://a.ml/vocabularies/amf/aml#or": [
{
"@id": "#/declarations/SchemaNode"
},
{
"@id": "#/declarations/SchemaNode_1"
},
{
"@id": "#/declarations/SchemaNode_2"
}
]
},
{
"@id": "#/declarations/SchemaNode_1",
Expand Down Expand Up @@ -223,19 +231,6 @@
],
"doc:link-label": "extension_Child"
},
{
"@id": "#/declarations/Child/list",
"@type": "rdfs:Seq",
"rdfs:_1": {
"@id": "#/declarations/SchemaNode"
},
"rdfs:_2": {
"@id": "#/declarations/SchemaNode_1"
},
"rdfs:_3": {
"@id": "#/declarations/SchemaNode_2"
}
},
{
"@id": "/exclusiveOr/shape/item1/property/property/b",
"@type": [
Expand Down Expand Up @@ -282,7 +277,6 @@
"@context": {
"@base": "file://amf-cli/shared/src/test/resources/semantic-jsonschema/json-schemas/oneOf-with-extended-schema.json",
"shacl": "http://www.w3.org/ns/shacl#",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"doc": "http://a.ml/vocabularies/document#",
"core": "http://a.ml/vocabularies/core#",
"owl": "http://www.w3.org/2002/07/owl#",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#%Dialect 1.0
nodeMappings:
Child:
union:
oneOf:
- SchemaNode
- SchemaNode_1
- SchemaNode_2
Expand Down
Loading

0 comments on commit d37b309

Please sign in to comment.