Skip to content

Commit 3b9e8cc

Browse files
authored
fix: remove Duty type properties (#199)
* Fix for Rule subtypes and Duty * Remove duty type properties
1 parent 1ba2e0b commit 3b9e8cc

File tree

5 files changed

+18
-73
lines changed

5 files changed

+18
-73
lines changed

artifacts/buildSrc/src/test/java/org/eclipse/dsp/generation/jsom/TestSchema.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,6 @@ public interface TestSchema {
195195
"items": {
196196
"$ref": "#/definitions/Constraint"
197197
}
198-
},
199-
"duty": {
200-
"$ref": "#/definitions/Duty"
201198
}
202199
},
203200
"required": [

artifacts/src/main/resources/catalog/example/catalog.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@
2929
"operator": "eq",
3030
"rightOperand": "http://example.org/EU"
3131
}
32-
],
33-
"duty": [
34-
{
35-
"action": "Attribution"
36-
}
3732
]
3833
}
3934
]

artifacts/src/main/resources/negotiation/contract-schema.json

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@
4242
"permission": {
4343
"type": "array",
4444
"items": {
45-
"$ref": "#/definitions/Rule"
45+
"$ref": "#/definitions/Permission"
4646
},
4747
"minItems": 1
4848
},
4949
"prohibition": {
5050
"type": "array",
5151
"items": {
52-
"$ref": "#/definitions/Rule"
52+
"$ref": "#/definitions/Prohibition"
5353
},
5454
"minItems": 1
5555
},
@@ -196,18 +196,28 @@
196196
"items": {
197197
"$ref": "#/definitions/Constraint"
198198
}
199-
},
200-
"duty": {
201-
"type": "array",
202-
"items": {
203-
"$ref": "#/definitions/Duty"
204-
}
205199
}
206200
},
207201
"required": [
208202
"action"
209203
]
210204
},
205+
"Permission": {
206+
"type": "object",
207+
"allOf": [
208+
{
209+
"$ref": "#/definitions/Rule"
210+
}
211+
]
212+
},
213+
"Prohibition": {
214+
"type": "object",
215+
"allOf": [
216+
{
217+
"$ref": "#/definitions/Rule"
218+
}
219+
]
220+
},
211221
"Duty": {
212222
"type": "object",
213223
"allOf": [

artifacts/src/main/resources/negotiation/example/contract-agreement-message-full.json

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -70,18 +70,6 @@
7070
"operator": "eq",
7171
"rightOperand": "gold"
7272
}
73-
],
74-
"duty": [
75-
{
76-
"action": "report",
77-
"constraint": [
78-
{
79-
"leftOperand": "event",
80-
"operator": "gt",
81-
"rightOperand": "use"
82-
}
83-
]
84-
}
8573
]
8674
},
8775
{

artifacts/src/test/java/org/eclipse/dsp/schema/negotiation/PolicySchemaTest.java

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ void verifySchema() {
2929
assertThat(schema.validate(POLICY_STRING_PROFILE, JSON)).isEmpty();
3030
assertThat(schema.validate(POLICY_ARRAY_PROFILE, JSON)).isEmpty();
3131
assertThat(schema.validate(POLICY_PERMISSION_DUTY, JSON)).isEmpty();
32-
assertThat(schema.validate(POLICY_PROHIBITION_DUTY, JSON)).isEmpty();
3332
assertThat(schema.validate(POLICY_OR_CONSTRAINT, JSON)).isEmpty();
3433
assertThat(schema.validate(POLICY_AND_CONSTRAINT, JSON)).isEmpty();
3534
assertThat(schema.validate(POLICY_AND_SEQUENCE_CONSTRAINT, JSON)).isEmpty();
@@ -54,9 +53,6 @@ void setUp() {
5453
"leftOperand": "partner",
5554
"operator": "eq",
5655
"rightOperand": "gold"
57-
}],
58-
"duty": [{
59-
"action": "report"
6056
}]
6157
}
6258
]
@@ -75,9 +71,6 @@ void setUp() {
7571
"leftOperand": "partner",
7672
"operator": "eq",
7773
"rightOperand": "gold"
78-
}],
79-
"duty": [{
80-
"action": "report"
8174
}]
8275
}
8376
]
@@ -96,9 +89,6 @@ void setUp() {
9689
"leftOperand": "partner",
9790
"operator": "eq",
9891
"rightOperand": "gold"
99-
}],
100-
"duty": [{
101-
"action": "report"
10292
}]
10393
}
10494
]
@@ -117,46 +107,11 @@ void setUp() {
117107
"leftOperand": "partner",
118108
"operator": "eq",
119109
"rightOperand": "gold"
120-
}],
121-
"duty": [{
122-
"action": "report",
123-
"constraint": [{
124-
"leftOperand": "event",
125-
"operator": "gt",
126-
"rightOperand": "use"
127-
}]
128110
}]
129111
}
130112
]
131113
}""";
132114

133-
private static final String POLICY_PROHIBITION_DUTY = """
134-
{
135-
"@id": "urn:uuid:3dd1add8-4d2d-569e-d634-8394a8836a88",
136-
"@type": "Offer",
137-
"target": "asset:1",
138-
"profile": ["https://test.com/profile"],
139-
"prohibition": [
140-
{
141-
"action": "use",
142-
"constraint": [{
143-
"leftOperand": "partner",
144-
"operator": "eq",
145-
"rightOperand": "gold"
146-
}],
147-
"duty": [{
148-
"action": "report",
149-
"constraint": [{
150-
"leftOperand": "event",
151-
"operator": "gt",
152-
"rightOperand": "use"
153-
}]
154-
}]
155-
}
156-
]
157-
}""";
158-
159-
160115
private static final String POLICY_OR_CONSTRAINT = """
161116
{
162117
"@id": "urn:uuid:3dd1add8-4d2d-569e-d634-8394a8836a88",

0 commit comments

Comments
 (0)