Skip to content

Commit 005765c

Browse files
committed
Graph receipt message type and message_id
1 parent 9afbd44 commit 005765c

File tree

3 files changed

+63
-171
lines changed

3 files changed

+63
-171
lines changed

schema/yaml/graph.yml

Lines changed: 28 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -10,100 +10,33 @@ output:
1010
description: 'Graph error'
1111
$ref: '/shared/message'
1212

13-
addnode:
14-
id: 'output/addnode'
15-
description: 'Add node to a graph.'
16-
$ref: '../input/addnode'
17-
18-
removenode:
19-
id: 'output/removenode'
20-
description: 'Remove a node from a graph.'
21-
$ref: '../input/removenode'
22-
23-
renamenode:
24-
id: 'output/renamenode'
25-
description: 'Change the ID of a node in the graph'
26-
$ref: '../input/renamenode'
27-
28-
changenode:
29-
id: 'output/changenode'
30-
description: 'Change the metadata associated to a node in the graph'
31-
$ref: '../input/changenode'
32-
33-
addedge:
34-
id: 'output/addedge'
35-
description: 'Add an edge to the graph'
36-
$ref: '../input/addedge'
37-
38-
removeedge:
39-
id: 'output/removeedge'
40-
description: 'Remove an edge from the graph'
41-
$ref: '../input/removeedge'
42-
43-
changeedge:
44-
id: 'output/changeedge'
45-
description: 'Change an edge''s metadata'
46-
$ref: '../input/changeedge'
47-
48-
addinitial:
49-
id: 'output/addinitial'
50-
description: 'Add an IIP to the graph'
51-
$ref: '../input/addinitial'
52-
53-
removeinitial:
54-
id: 'output/removeinitial'
55-
description: 'Remove an IIP from the graph'
56-
$ref: '../input/removeinitial'
57-
58-
addinport:
59-
id: 'output/addinport'
60-
description: 'Add an exported inport to the graph.'
61-
$ref: '../input/addinport'
62-
63-
removeinport:
64-
id: 'output/removeinport'
65-
description: 'Remove an exported port from the graph'
66-
$ref: '../input/removeinport'
67-
68-
renameinport:
69-
id: 'output/renameinport'
70-
description: 'Rename an exported port in the graph'
71-
$ref: '../input/renameinport'
72-
73-
addoutport:
74-
id: 'output/addoutport'
75-
description: 'Add an exported outport to the graph.'
76-
$ref: '../input/addoutport'
77-
78-
removeoutport:
79-
id: 'output/removeoutport'
80-
description: 'Remove an exported port from the graph'
81-
$ref: '../input/removeoutport'
82-
83-
renameoutport:
84-
id: 'output/renameoutport'
85-
description: 'Rename an exported port in the graph'
86-
$ref: '../input/renameoutport'
87-
88-
addgroup:
89-
id: 'output/addgroup'
90-
description: 'Add a group to the graph'
91-
$ref: '../input/addgroup'
92-
93-
removegroup:
94-
id: 'output/removegroup'
95-
description: 'Remove a group from the graph'
96-
$ref: '../input/removegroup'
97-
98-
renamegroup:
99-
id: 'output/renamegroup'
100-
description: 'Rename a group in the graph.'
101-
$ref: '../input/renamegroup'
102-
103-
changegroup:
104-
id: 'output/changegroup'
105-
description: 'Change a group''s metadata'
106-
$ref: '../input/changegroup'
13+
receipt:
14+
id: 'output/receipt'
15+
description: >-
16+
Acknowledge that message reached receiver and whether or not receiver
17+
responded successfully. Messages that create or change graphs should
18+
be responded to with receipt messages.
19+
allOf:
20+
- $ref: '/shared/message'
21+
- properties:
22+
protocol:
23+
enum: ['graph']
24+
command:
25+
enum: ['receipt']
26+
payload:
27+
required: ['message_id', 'success']
28+
additionalProperties: false
29+
properties:
30+
message_id:
31+
type: string
32+
description: 'Id of input message'
33+
success:
34+
type: boolean
35+
description: 'Whether or not message was successfully processed'
36+
error:
37+
type: string
38+
description: >-
39+
Error description if original message did not succeed
10740
10841
input:
10942
error:
@@ -118,7 +51,7 @@ input:
11851
protocol:
11952
enum: ['graph']
12053
command:
121-
enum: ['addnode']
54+
enum: ['clear']
12255
payload:
12356
required: ['id']
12457
additionalProperties: false

schema/yaml/shared.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ message:
2626
payload:
2727
type: object
2828
description: 'content of message'
29+
id:
30+
type: string
31+
description: 'unique id of message'
2932

3033
port:
3134
id: 'port'

test/schema/test_graph.coffee

Lines changed: 32 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,44 @@ describe 'Test graph protocol schema on event', ->
99
tv4.addSchema '/shared/', sharedSchema
1010
tv4.addSchema '/graph/', graphSchema
1111

12+
describe 'receipt', ->
13+
schema = '/graph/output/receipt'
14+
15+
it 'should have output schema', ->
16+
chai.expect(tv4.getSchema schema).to.exist
17+
18+
it 'should validate event with required fields', ->
19+
event =
20+
protocol: 'graph'
21+
command: 'receipt'
22+
payload:
23+
message_id: 'message1'
24+
success: true
25+
26+
chai.expect(tv4.validate event, schema).to.be.true
27+
28+
describe 'clear', ->
29+
schema = '/graph/input/clear'
30+
31+
it 'should have input schema', ->
32+
chai.expect(tv4.getSchema schema).to.exist
33+
34+
it 'should validate event with required fields', ->
35+
event =
36+
protocol: 'graph'
37+
command: 'clear'
38+
payload:
39+
id: 'graph1'
40+
secret: 'abcdefg'
41+
42+
chai.expect(tv4.validate event, schema).to.be.true
43+
1244
describe 'addnode', ->
1345
schema = '/graph/input/addnode'
1446

1547
it 'should have input schema', ->
1648
chai.expect(tv4.getSchema schema).to.exist
1749

18-
it 'should have output shema', ->
19-
chai.expect(tv4.getSchema(schema).properties).to.eql(
20-
tv4.getSchema('/graph/output/addnode').properties)
21-
2250
it 'should validate event with required fields', ->
2351
event =
2452
protocol: 'graph'
@@ -70,10 +98,6 @@ describe 'Test graph protocol schema on event', ->
7098
it 'should have input schema', ->
7199
chai.expect(tv4.getSchema schema).to.exist
72100

73-
it 'should have output shema', ->
74-
chai.expect(tv4.getSchema(schema).properties).to.eql(
75-
tv4.getSchema('/graph/output/removenode').properties)
76-
77101
it 'should validate event with required fields', ->
78102
event =
79103
protocol: 'graph'
@@ -90,10 +114,6 @@ describe 'Test graph protocol schema on event', ->
90114
it 'should have input schema', ->
91115
chai.expect(tv4.getSchema schema).to.exist
92116

93-
it 'should have output shema', ->
94-
chai.expect(tv4.getSchema(schema).properties).to.eql(
95-
tv4.getSchema('/graph/output/renamenode').properties)
96-
97117
it 'should validate event with required fields', ->
98118
event =
99119
protocol: 'graph'
@@ -111,10 +131,6 @@ describe 'Test graph protocol schema on event', ->
111131
it 'should have input schema', ->
112132
chai.expect(tv4.getSchema schema).to.exist
113133

114-
it 'should have output shema', ->
115-
chai.expect(tv4.getSchema(schema).properties).to.eql(
116-
tv4.getSchema('/graph/output/changenode').properties)
117-
118134
it 'should validate event with required fields', ->
119135
event =
120136
protocol: 'graph'
@@ -144,10 +160,6 @@ describe 'Test graph protocol schema on event', ->
144160
it 'should have input schema', ->
145161
chai.expect(tv4.getSchema schema).to.exist
146162

147-
it 'should have output schema', ->
148-
chai.expect(tv4.getSchema(schema).properties).to.eql(
149-
tv4.getSchema('/graph/output/addedge').properties)
150-
151163
it 'should validate event with required fields', ->
152164
event =
153165
protocol: 'graph'
@@ -182,10 +194,6 @@ describe 'Test graph protocol schema on event', ->
182194
it 'should have input schema', ->
183195
chai.expect(tv4.getSchema schema).to.exist
184196

185-
it 'should have output schema', ->
186-
chai.expect(tv4.getSchema(schema).properties).to.eql(
187-
tv4.getSchema('/graph/output/removeedge').properties)
188-
189197
it 'should validate event with required fields', ->
190198
event =
191199
protocol: 'graph'
@@ -207,10 +215,6 @@ describe 'Test graph protocol schema on event', ->
207215
it 'should have input schema', ->
208216
chai.expect(tv4.getSchema schema).to.exist
209217

210-
it 'should have output schema', ->
211-
chai.expect(tv4.getSchema(schema).properties).to.eql(
212-
tv4.getSchema('/graph/output/changeedge').properties)
213-
214218
it 'should validate event with required fields', ->
215219
event =
216220
protocol: 'graph'
@@ -234,10 +238,6 @@ describe 'Test graph protocol schema on event', ->
234238
it 'should have input schema', ->
235239
chai.expect(tv4.getSchema schema).to.exist
236240

237-
it 'should have output shema', ->
238-
chai.expect(tv4.getSchema(schema).properties).to.eql(
239-
tv4.getSchema('/graph/output/addinitial').properties)
240-
241241
it 'should validate event with required fields', ->
242242
event =
243243
protocol: 'graph'
@@ -271,10 +271,6 @@ describe 'Test graph protocol schema on event', ->
271271
it 'should have input shema', ->
272272
chai.expect(tv4.getSchema schema).to.exist
273273

274-
it 'should have output shema', ->
275-
chai.expect(tv4.getSchema(schema).properties).to.eql(
276-
tv4.getSchema('/graph/output/removeinitial').properties)
277-
278274
it 'should validate event with required fields', ->
279275
event =
280276
protocol: 'graph'
@@ -307,10 +303,6 @@ describe 'Test graph protocol schema on event', ->
307303
it 'should have input shema', ->
308304
chai.expect(tv4.getSchema schema).to.exist
309305

310-
it 'should have output schema', ->
311-
chai.expect(tv4.getSchema(schema).properties).to.eql(
312-
tv4.getSchema('/graph/output/addinport').properties)
313-
314306
it 'should validate event with required fields', ->
315307
event =
316308
protocol: 'graph'
@@ -342,10 +334,6 @@ describe 'Test graph protocol schema on event', ->
342334
it 'should have input shema', ->
343335
chai.expect(tv4.getSchema schema).to.exist
344336

345-
it 'should have output schema', ->
346-
chai.expect(tv4.getSchema(schema).properties).to.eql(
347-
tv4.getSchema('/graph/output/removeinport').properties)
348-
349337
it 'should validate event with required fields', ->
350338
event =
351339
protocol: 'graph'
@@ -374,10 +362,6 @@ describe 'Test graph protocol schema on event', ->
374362
it 'should have input shema', ->
375363
chai.expect(tv4.getSchema schema).to.exist
376364

377-
it 'should have output schema', ->
378-
chai.expect(tv4.getSchema(schema).properties).to.eql(
379-
tv4.getSchema('/graph/output/renameinport').properties)
380-
381365
it 'should validate event with required fields', ->
382366
event =
383367
protocol: 'graph'
@@ -395,10 +379,6 @@ describe 'Test graph protocol schema on event', ->
395379
it 'should have input shema', ->
396380
chai.expect(tv4.getSchema schema).to.exist
397381

398-
it 'should have output schema', ->
399-
chai.expect(tv4.getSchema(schema).properties).to.eql(
400-
tv4.getSchema('/graph/output/addoutport').properties)
401-
402382
it 'should validate event with required fields', ->
403383
event =
404384
protocol: 'graph'
@@ -430,10 +410,6 @@ describe 'Test graph protocol schema on event', ->
430410
it 'should have input shema', ->
431411
chai.expect(tv4.getSchema schema).to.exist
432412

433-
it 'should have output schema', ->
434-
chai.expect(tv4.getSchema(schema).properties).to.eql(
435-
tv4.getSchema('/graph/output/removeoutport').properties)
436-
437413
it 'should validate event with required fields', ->
438414
event =
439415
protocol: 'graph'
@@ -462,10 +438,6 @@ describe 'Test graph protocol schema on event', ->
462438
it 'should have input shema', ->
463439
chai.expect(tv4.getSchema schema).to.exist
464440

465-
it 'should have output schema', ->
466-
chai.expect(tv4.getSchema(schema).properties).to.eql(
467-
tv4.getSchema('/graph/output/renameoutport').properties)
468-
469441
it 'should validate event with required fields', ->
470442
event =
471443
protocol: 'graph'
@@ -483,10 +455,6 @@ describe 'Test graph protocol schema on event', ->
483455
it 'should have input schema', ->
484456
chai.expect(tv4.getSchema schema).to.exist
485457

486-
it 'should have output shema', ->
487-
chai.expect(tv4.getSchema(schema).properties).to.eql(
488-
tv4.getSchema('/graph/output/addgroup').properties)
489-
490458
it 'should validate event with required fields', ->
491459
event =
492460
protocol: 'graph'
@@ -516,10 +484,6 @@ describe 'Test graph protocol schema on event', ->
516484
it 'should have input shema', ->
517485
chai.expect(tv4.getSchema schema).to.exist
518486

519-
it 'should have output schema', ->
520-
chai.expect(tv4.getSchema(schema).properties).to.eql(
521-
tv4.getSchema('/graph/output/removegroup').properties)
522-
523487
it 'should validate event with required fields', ->
524488
event =
525489
protocol: 'graph'
@@ -536,10 +500,6 @@ describe 'Test graph protocol schema on event', ->
536500
it 'should have input shema', ->
537501
chai.expect(tv4.getSchema schema).to.exist
538502

539-
it 'should have output schema', ->
540-
chai.expect(tv4.getSchema(schema).properties).to.eql(
541-
tv4.getSchema('/graph/output/renamegroup').properties)
542-
543503
it 'should validate event with required fields', ->
544504
event =
545505
protocol: 'graph'
@@ -557,10 +517,6 @@ describe 'Test graph protocol schema on event', ->
557517
it 'should have input schema', ->
558518
chai.expect(tv4.getSchema schema).to.exist
559519

560-
it 'should have output shema', ->
561-
chai.expect(tv4.getSchema(schema).properties).to.eql(
562-
tv4.getSchema('/graph/output/changegroup').properties)
563-
564520
it 'should validate event with required fields', ->
565521
event =
566522
protocol: 'graph'

0 commit comments

Comments
 (0)