@atlaskit/adf-schema 36.12.0 → 36.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/cjs/next-schema/full-schema.adf.js +1 -1
- package/dist/cjs/next-schema/nodes/blockCard.js +5 -5
- package/dist/cjs/next-schema/nodes/bodiedExtension.js +2 -2
- package/dist/cjs/next-schema/nodes/codeBlock.js +2 -1
- package/dist/cjs/next-schema/nodes/extension.js +2 -2
- package/dist/cjs/next-schema/nodes/inlineCard.js +0 -2
- package/dist/cjs/next-schema/nodes/inlineExtension.js +2 -2
- package/dist/cjs/next-schema/nodes/list.js +2 -1
- package/dist/cjs/next-schema/nodes/media.js +11 -11
- package/dist/cjs/next-schema/nodes/mediaInline.js +2 -1
- package/dist/cjs/next-schema/nodes/mediaSingle.js +8 -9
- package/dist/cjs/next-schema/nodes/table.js +3 -1
- package/dist/cjs/next-schema/nodes/tableRow.js +1 -1
- package/dist/es2019/next-schema/full-schema.adf.js +2 -2
- package/dist/es2019/next-schema/nodes/blockCard.js +5 -5
- package/dist/es2019/next-schema/nodes/bodiedExtension.js +2 -2
- package/dist/es2019/next-schema/nodes/codeBlock.js +2 -1
- package/dist/es2019/next-schema/nodes/extension.js +2 -2
- package/dist/es2019/next-schema/nodes/inlineCard.js +0 -2
- package/dist/es2019/next-schema/nodes/inlineExtension.js +2 -2
- package/dist/es2019/next-schema/nodes/list.js +2 -1
- package/dist/es2019/next-schema/nodes/media.js +11 -11
- package/dist/es2019/next-schema/nodes/mediaInline.js +2 -1
- package/dist/es2019/next-schema/nodes/mediaSingle.js +8 -9
- package/dist/es2019/next-schema/nodes/table.js +3 -1
- package/dist/es2019/next-schema/nodes/tableRow.js +2 -2
- package/dist/esm/next-schema/full-schema.adf.js +2 -2
- package/dist/esm/next-schema/nodes/blockCard.js +5 -5
- package/dist/esm/next-schema/nodes/bodiedExtension.js +2 -2
- package/dist/esm/next-schema/nodes/codeBlock.js +2 -1
- package/dist/esm/next-schema/nodes/extension.js +2 -2
- package/dist/esm/next-schema/nodes/inlineCard.js +0 -2
- package/dist/esm/next-schema/nodes/inlineExtension.js +2 -2
- package/dist/esm/next-schema/nodes/list.js +2 -1
- package/dist/esm/next-schema/nodes/media.js +11 -11
- package/dist/esm/next-schema/nodes/mediaInline.js +2 -1
- package/dist/esm/next-schema/nodes/mediaSingle.js +8 -9
- package/dist/esm/next-schema/nodes/table.js +3 -1
- package/dist/esm/next-schema/nodes/tableRow.js +2 -2
- package/dist/types/next-schema/full-schema.adf.d.ts +1 -0
- package/dist/types/next-schema/groups/nonNestableBlockContentGroup.d.ts +4 -0
- package/dist/types/next-schema/nodes/blockCard.d.ts +1 -0
- package/dist/types/next-schema/nodes/blockquote.d.ts +1 -0
- package/dist/types/next-schema/nodes/bodiedExtension.d.ts +1 -0
- package/dist/types/next-schema/nodes/caption.d.ts +1 -0
- package/dist/types/next-schema/nodes/codeBlock.d.ts +2 -0
- package/dist/types/next-schema/nodes/date.d.ts +1 -0
- package/dist/types/next-schema/nodes/decisionItem.d.ts +1 -0
- package/dist/types/next-schema/nodes/decisionList.d.ts +1 -0
- package/dist/types/next-schema/nodes/embedCard.d.ts +1 -0
- package/dist/types/next-schema/nodes/emoji.d.ts +1 -0
- package/dist/types/next-schema/nodes/expand.d.ts +1 -0
- package/dist/types/next-schema/nodes/extension.d.ts +1 -0
- package/dist/types/next-schema/nodes/extensionFrame.d.ts +1 -0
- package/dist/types/next-schema/nodes/hardBreak.d.ts +1 -0
- package/dist/types/next-schema/nodes/heading.d.ts +2 -0
- package/dist/types/next-schema/nodes/inlineCard.d.ts +1 -0
- package/dist/types/next-schema/nodes/inlineExtension.d.ts +1 -0
- package/dist/types/next-schema/nodes/layoutColumn.d.ts +1 -0
- package/dist/types/next-schema/nodes/layoutSection.d.ts +1 -0
- package/dist/types/next-schema/nodes/list.d.ts +2 -0
- package/dist/types/next-schema/nodes/media.d.ts +1 -0
- package/dist/types/next-schema/nodes/mediaGroup.d.ts +1 -0
- package/dist/types/next-schema/nodes/mediaInline.d.ts +1 -0
- package/dist/types/next-schema/nodes/mediaSingle.d.ts +1 -0
- package/dist/types/next-schema/nodes/mention.d.ts +1 -0
- package/dist/types/next-schema/nodes/multiBodiedExtension.d.ts +1 -0
- package/dist/types/next-schema/nodes/nestedExpand.d.ts +1 -0
- package/dist/types/next-schema/nodes/panel.d.ts +1 -0
- package/dist/types/next-schema/nodes/paragraph.d.ts +1 -0
- package/dist/types/next-schema/nodes/placeholder.d.ts +1 -0
- package/dist/types/next-schema/nodes/rule.d.ts +1 -0
- package/dist/types/next-schema/nodes/status.d.ts +1 -0
- package/dist/types/next-schema/nodes/table.d.ts +1 -0
- package/dist/types/next-schema/nodes/tableCell.d.ts +1 -0
- package/dist/types/next-schema/nodes/tableHeader.d.ts +1 -0
- package/dist/types/next-schema/nodes/tableRow.d.ts +1 -0
- package/dist/types/next-schema/nodes/task.d.ts +2 -0
- package/dist/types/next-schema/nodes/text.d.ts +1 -0
- package/package.json +5 -4
- package/schema-generators/__tests__/unit/adfToValidatorSpec.unit.ts +86 -44
- package/schema-generators/__tests__/unit/jqueries.md +13 -0
- package/schema-generators/__tests__/unit/json-full-schema.unit.ts +103 -0
@@ -1,69 +1,111 @@
|
|
1
1
|
import { adfToValidatorSpec } from '@atlaskit/adf-schema-generator';
|
2
2
|
import adfNode from '@atlaskit/adf-schema/src/next-schema/full-schema.adf';
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
// currently doesn't work, will fix with next PR
|
5
|
+
test.skip('should be able to handle heading', () => {
|
6
|
+
const result = sortNestedArrays(adfToValidatorSpec(adfNode));
|
6
7
|
|
7
|
-
expect(result.
|
8
|
-
heading_with_alignment.props,
|
9
|
-
);
|
8
|
+
expect(result.heading.json).toEqual(sortNestedArrays(heading));
|
10
9
|
});
|
11
10
|
|
12
|
-
test('should be able to handle
|
13
|
-
const result = adfToValidatorSpec(adfNode);
|
11
|
+
test('should be able to handle the panel node', () => {
|
12
|
+
const result = sortNestedArrays(adfToValidatorSpec(adfNode));
|
14
13
|
|
15
|
-
expect(result.
|
14
|
+
expect(result.panel.json).toEqual(sortNestedArrays(panel));
|
16
15
|
});
|
17
16
|
|
18
|
-
|
17
|
+
test('should be able to handle mentions', () => {
|
18
|
+
const result = sortNestedArrays(adfToValidatorSpec(adfNode));
|
19
|
+
|
20
|
+
expect(result.mention.json).toEqual(sortNestedArrays(mention));
|
21
|
+
});
|
22
|
+
|
23
|
+
function sortNestedArrays(obj: any): any {
|
24
|
+
if (Array.isArray(obj)) {
|
25
|
+
return obj.sort();
|
26
|
+
}
|
27
|
+
if (typeof obj === 'object') {
|
28
|
+
for (const key in obj) {
|
29
|
+
obj[key] = sortNestedArrays(obj[key]);
|
30
|
+
}
|
31
|
+
}
|
32
|
+
return obj;
|
33
|
+
}
|
34
|
+
|
35
|
+
const mention = {
|
19
36
|
props: {
|
37
|
+
type: { type: 'enum', values: ['mention'] },
|
20
38
|
attrs: {
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
39
|
+
props: {
|
40
|
+
id: { type: 'string' },
|
41
|
+
text: { type: 'string', optional: true },
|
42
|
+
userType: {
|
43
|
+
type: 'enum',
|
44
|
+
values: ['DEFAULT', 'SPECIAL', 'APP'],
|
45
|
+
optional: true,
|
46
|
+
},
|
47
|
+
accessLevel: { type: 'string', optional: true },
|
48
|
+
localId: { type: 'string', optional: true },
|
49
|
+
},
|
50
|
+
},
|
51
|
+
},
|
52
|
+
};
|
53
|
+
|
54
|
+
const panel = {
|
55
|
+
props: {
|
56
|
+
type: { type: 'enum', values: ['panel'] },
|
57
|
+
attrs: {
|
58
|
+
props: {
|
59
|
+
panelType: {
|
60
|
+
type: 'enum',
|
61
|
+
values: [
|
62
|
+
'info',
|
63
|
+
'note',
|
64
|
+
'tip',
|
65
|
+
'warning',
|
66
|
+
'error',
|
67
|
+
'success',
|
68
|
+
'custom',
|
69
|
+
],
|
70
|
+
},
|
71
|
+
panelIcon: { type: 'string', optional: true },
|
72
|
+
panelIconId: { type: 'string', optional: true },
|
73
|
+
panelIconText: { type: 'string', optional: true },
|
74
|
+
panelColor: { type: 'string', optional: true },
|
26
75
|
},
|
27
76
|
},
|
28
77
|
content: {
|
29
|
-
items: ['inline'],
|
30
|
-
minItems: 0,
|
31
78
|
type: 'array',
|
32
|
-
},
|
33
|
-
marks: {
|
34
79
|
items: [
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
80
|
+
[
|
81
|
+
'codeBlock_with_no_marks',
|
82
|
+
'blockCard',
|
83
|
+
'paragraph_with_no_marks',
|
84
|
+
'mediaSingle_caption',
|
85
|
+
'mediaSingle_full',
|
86
|
+
'taskList',
|
87
|
+
'bulletList',
|
88
|
+
'orderedList',
|
89
|
+
'heading_with_no_marks',
|
90
|
+
'mediaGroup',
|
91
|
+
'decisionList',
|
92
|
+
'rule',
|
93
|
+
],
|
46
94
|
],
|
47
|
-
|
48
|
-
},
|
49
|
-
type: {
|
50
|
-
type: 'enum',
|
51
|
-
values: ['heading'],
|
95
|
+
minItems: 1,
|
52
96
|
},
|
53
97
|
},
|
54
98
|
};
|
55
99
|
|
56
|
-
const
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
userType: {
|
63
|
-
type: 'enum',
|
64
|
-
values: ['DEFAULT', 'SPECIAL', 'APP'],
|
65
|
-
default: null,
|
100
|
+
const heading = {
|
101
|
+
props: {
|
102
|
+
type: { type: 'enum', values: ['heading'] },
|
103
|
+
content: {
|
104
|
+
type: 'array',
|
105
|
+
items: ['inline'],
|
66
106
|
optional: true,
|
67
107
|
},
|
108
|
+
marks: { type: 'array', items: [], optional: true },
|
109
|
+
attrs: { props: { level: { type: 'number', minimum: 1, maximum: 6 } } },
|
68
110
|
},
|
69
111
|
};
|
@@ -166,3 +166,16 @@ A number of nodes have `marks` defined, yet the array is empty. Assuming this is
|
|
166
166
|
.block_content, .nestedExpand_content, .non_nestable_block_content, .table_cell_content, .inline_node,
|
167
167
|
.bodiedExtension_node.properties.marks, .codeBlock_node.properties.marks, .expand_node.properties.marks, .heading_node.properties.marks, .inlineExtension_node.properties.marks, .text_node.properties.marks, .extension_node.properties.marks, .paragraph_node.properties.marks) else . end)' | pbcopy
|
168
168
|
```
|
169
|
+
|
170
|
+
Base level content objects (not nodes) are deleted. `inline` is also deleted, as it is a content object for paragraph.
|
171
|
+
|
172
|
+
`additionalProperties` and `allOf` are deleted as well.
|
173
|
+
|
174
|
+
A number of nodes have `marks` defined, yet the array is empty. Assuming this is redundant, I've removed them.
|
175
|
+
|
176
|
+
```sh
|
177
|
+
cat packages/adf-schema/json-schema/v1/full.json | jq 'walk(if type == "object" then del(
|
178
|
+
.additionalProperties, .allOf, .properties.required,
|
179
|
+
.block_content, .nestedExpand_content, .non_nestable_block_content, .table_cell_content, .inline_node,
|
180
|
+
.bodiedExtension_node.properties.marks, .codeBlock_node.properties.marks, .expand_node.properties.marks, .heading_node.properties.marks, .inlineExtension_node.properties.marks, .text_node.properties.marks, .extension_node.properties.marks, .paragraph_node.properties.marks) else . end)' | pbcopy
|
181
|
+
```
|