Commit 1c7838db4a112873f77b9c4e8962ac23b04bbbf7
extract mentions and recps as common definitions
mix irving committed on 3/5/2018, 5:47:35 AMParent: 3bc106d06cd050c026b7934dacf2076f6d847894
Files changed
lib/ssbSchemaDefintions.js | changed |
poll/schema/poll.js | changed |
position/schema/position.js | changed |
lib/ssbSchemaDefintions.js | ||
---|---|---|
@@ -35,7 +35,36 @@ | ||
35 | 35 | properties: { |
36 | 36 | link: { $ref: '#/definitions/blobId' }, |
37 | 37 | name: { type: 'string' } |
38 | 38 | } |
39 | + }, | |
40 | + any: { | |
41 | + oneOf: [ | |
42 | + { type: 'null' }, | |
43 | + { | |
44 | + type: 'array', | |
45 | + items: { | |
46 | + oneOf: [ | |
47 | + { $ref: '#/definitions/mentions/message' }, | |
48 | + { $ref: '#/definitions/mentions/feed' }, | |
49 | + { $ref: '#/definitions/mentions/blob' } | |
50 | + ] | |
51 | + } | |
52 | + } | |
53 | + ] | |
39 | 54 | } |
55 | + }, | |
56 | + recps: { | |
57 | + oneOf: [ | |
58 | + { type: 'null' }, | |
59 | + { | |
60 | + type: 'array', | |
61 | + items: { | |
62 | + oneOf: [ | |
63 | + { $ref: '#/definitions/feedId' }, | |
64 | + { $ref: '#/definitions/mentions/feed' } | |
65 | + ] | |
66 | + } | |
67 | + } | |
68 | + ] | |
40 | 69 | } |
41 | 70 | } |
poll/schema/poll.js | ||
---|---|---|
@@ -30,49 +30,19 @@ | ||
30 | 30 | }, |
31 | 31 | title: { type: 'string' }, |
32 | 32 | closesAt: { type: 'integer' }, |
33 | 33 | body: { type: 'string' }, |
34 | - mentions: { | |
35 | - oneOf: [ | |
36 | - { type: 'null' }, | |
37 | - { | |
38 | - type: 'array', | |
39 | - items: { | |
40 | - oneOf: [ | |
41 | - { $ref: '#/definitions/mentions/message' }, | |
42 | - { $ref: '#/definitions/mentions/feed' }, | |
43 | - { $ref: '#/definitions/mentions/blob' } | |
44 | - ] | |
45 | - } | |
46 | - } | |
47 | - ] | |
48 | - }, | |
49 | - recps: { | |
50 | - oneOf: [ | |
51 | - { type: 'null' }, | |
52 | - { | |
53 | - type: 'array', | |
54 | - items: { | |
55 | - oneOf: [ | |
56 | - { $ref: '#/definitions/feedId' }, | |
57 | - { $ref: '#/definitions/mentions/feed' } | |
58 | - ] | |
59 | - } | |
60 | - } | |
61 | - ] | |
62 | - } | |
34 | + mentions: { $ref: '#/definitions/mentions/any' }, | |
35 | + recps: { $ref: '#/definitions/recps' } | |
63 | 36 | }, |
64 | - definitions: Object.assign({}, | |
65 | - ssbSchemaDefintions, | |
66 | - { | |
67 | - pollDetails: { | |
68 | - type: 'object', | |
69 | - dot: dotDetails, | |
70 | - proposal: proposalDetails, | |
71 | - score: scoreDetails, | |
72 | - chooseOne: chooseOneDetails | |
73 | - } | |
37 | + definitions: Object.assign({}, ssbSchemaDefintions, { | |
38 | + pollDetails: { | |
39 | + type: 'object', | |
40 | + dot: dotDetails, | |
41 | + proposal: proposalDetails, | |
42 | + score: scoreDetails, | |
43 | + chooseOne: chooseOneDetails | |
74 | 44 | } |
75 | - ) | |
45 | + }) | |
76 | 46 | } |
77 | 47 | |
78 | 48 | module.exports = schema |
position/schema/position.js | ||
---|---|---|
@@ -27,46 +27,16 @@ | ||
27 | 27 | // { $ref: '#/definitions/positionDetails/rsvp'}, |
28 | 28 | // { $ref: '#/definitions/positionDetails/meeting'}, |
29 | 29 | ] |
30 | 30 | }, |
31 | - mentions: { | |
32 | - oneOf: [ | |
33 | - { type: 'null' }, | |
34 | - { | |
35 | - type: 'array', | |
36 | - items: { | |
37 | - oneOf: [ | |
38 | - { $ref: '#/definitions/mentions/message' }, | |
39 | - { $ref: '#/definitions/mentions/feed' }, | |
40 | - { $ref: '#/definitions/mentions/blob' } | |
41 | - ] | |
42 | - } | |
43 | - } | |
44 | - ] | |
45 | - }, | |
46 | - recps: { | |
47 | - oneOf: [ | |
48 | - { type: 'null' }, | |
49 | - { | |
50 | - type: 'array', | |
51 | - items: { | |
52 | - oneOf: [ | |
53 | - { $ref: '#/definitions/feedId' }, | |
54 | - { $ref: '#/definitions/mentions/feed' } | |
55 | - ] | |
56 | - } | |
57 | - } | |
58 | - ] | |
59 | - } | |
31 | + mentions: { $ref: '#/definitions/mentions/any' }, | |
32 | + recps: { $ref: '#/definitions/recps' } | |
60 | 33 | }, |
61 | - definitions: Object.assign({}, | |
62 | - ssbSchemaDefintions, | |
63 | - { | |
64 | - positionDetails: { | |
65 | - type: 'object', | |
66 | - chooseOne: chooseOneDetails | |
67 | - } | |
34 | + definitions: Object.assign({}, ssbSchemaDefintions, { | |
35 | + positionDetails: { | |
36 | + type: 'object', | |
37 | + chooseOne: chooseOneDetails | |
68 | 38 | } |
69 | - ) | |
39 | + }) | |
70 | 40 | } |
71 | 41 | |
72 | 42 | module.exports = schema |
Built with git-ssb-web