@atlaskit/adf-schema 37.1.40 → 37.1.42
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 +12 -0
- package/dist/cjs/next-schema/groups/atomicInlineGroup.js +19 -0
- package/dist/cjs/next-schema/groups/tableCellContentPseudoGroup.js +1 -1
- package/dist/cjs/next-schema/nodes/nestedExpand.js +1 -1
- package/dist/cjs/next-schema/nodes/paragraph.js +2 -1
- package/dist/cjs/next-schema/nodes/tableCellContent.js +1 -1
- package/dist/cjs/validator-schema/generated/validatorSpec.js +1875 -0
- package/dist/cjs/validator-schema/utils/sortNestedArrays.js +33 -0
- package/dist/es2019/next-schema/groups/atomicInlineGroup.js +13 -0
- package/dist/es2019/next-schema/groups/tableCellContentPseudoGroup.js +1 -1
- package/dist/es2019/next-schema/nodes/nestedExpand.js +1 -1
- package/dist/es2019/next-schema/nodes/paragraph.js +2 -1
- package/dist/es2019/next-schema/nodes/tableCellContent.js +1 -1
- package/dist/es2019/validator-schema/generated/validatorSpec.js +1869 -0
- package/dist/es2019/validator-schema/utils/sortNestedArrays.js +24 -0
- package/dist/esm/next-schema/groups/atomicInlineGroup.js +13 -0
- package/dist/esm/next-schema/groups/tableCellContentPseudoGroup.js +1 -1
- package/dist/esm/next-schema/nodes/nestedExpand.js +1 -1
- package/dist/esm/next-schema/nodes/paragraph.js +2 -1
- package/dist/esm/next-schema/nodes/tableCellContent.js +1 -1
- package/dist/esm/validator-schema/generated/validatorSpec.js +1869 -0
- package/dist/esm/validator-schema/utils/sortNestedArrays.js +26 -0
- package/dist/types/next-schema/groups/atomicInlineGroup.d.ts +1 -0
- package/dist/types/next-schema/nodes/nestedExpand.d.ts +1 -1
- package/dist/types/validator-schema/generated/validatorSpec.d.ts +1888 -0
- package/dist/types/validator-schema/utils/sortNestedArrays.d.ts +1 -0
- package/package.json +3 -2
- package/schema-generators/__tests__/unit/adfToValidatorSpecValidation.unit.ts +2 -42
- package/schema-generators/__tests__/unit/json-full-schema-backwards-compat.unit.ts +23 -46
- package/schema-generators/validator-full-schema.ts +22 -0
@@ -0,0 +1,24 @@
|
|
1
|
+
export function sortNestedArrays(obj) {
|
2
|
+
if (obj === null || obj === undefined) {
|
3
|
+
return obj;
|
4
|
+
}
|
5
|
+
if (Array.isArray(obj) && typeof obj[0] === 'string' && typeof obj[1] === 'object') {
|
6
|
+
// 1. tuple of object + string
|
7
|
+
obj[1] = sortNestedArrays(obj[1]);
|
8
|
+
} else if (Array.isArray(obj) && Array.isArray(obj[0])) {
|
9
|
+
// 2. array of arrays
|
10
|
+
for (let i = 0; i < obj.length; i++) {
|
11
|
+
obj[i] = sortNestedArrays(obj[i]);
|
12
|
+
}
|
13
|
+
} else if (Array.isArray(obj) && !Array.isArray(obj[0]) && typeof obj[0] !== 'object') {
|
14
|
+
// 3. simple array
|
15
|
+
obj.sort();
|
16
|
+
}
|
17
|
+
if (typeof obj === 'object') {
|
18
|
+
// 4. object
|
19
|
+
for (const key of Object.keys(obj)) {
|
20
|
+
obj[key] = sortNestedArrays(obj[key]);
|
21
|
+
}
|
22
|
+
}
|
23
|
+
return obj;
|
24
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { adfNodeGroup } from '@atlaskit/adf-schema-generator';
|
2
|
+
import { date } from '../nodes/date';
|
3
|
+
import { emoji } from '../nodes/emoji';
|
4
|
+
import { hardBreak } from '../nodes/hardBreak';
|
5
|
+
import { inlineCard } from '../nodes/inlineCard';
|
6
|
+
import { inlineExtension } from '../nodes/inlineExtension';
|
7
|
+
import { mediaInline } from '../nodes/mediaInline';
|
8
|
+
import { mention } from '../nodes/mention';
|
9
|
+
import { placeholder } from '../nodes/placeholder';
|
10
|
+
import { status } from '../nodes/status';
|
11
|
+
export var atomicInlineGroup = adfNodeGroup('atomic_inline', [hardBreak, mention, emoji, inlineExtension.use('with_marks'), date, placeholder, inlineCard, status, mediaInline], {
|
12
|
+
ignore: ['pm-spec', 'json-schema']
|
13
|
+
});
|
@@ -21,6 +21,6 @@ var tableCellContentNodes = [codeBlock.use('with_no_marks'), blockCard, paragrap
|
|
21
21
|
// @DSLCompatibilityException JSON Schema and PM Spec are not in sync. We need to fix it
|
22
22
|
// In PM Spec, they contain different items. (tableHeader using tableHeaderContentPseudoGroup, tableCell using tableCellContentPseudoGroup)
|
23
23
|
// In JSON Schema, both tableHeader and tableCell points to tableCellContentPseudoGroup
|
24
|
-
// The differences are
|
24
|
+
// The differences are highlighted below.
|
25
25
|
export var tableCellContentPseudoGroup = $onePlus($or.apply(void 0, tableCellContentNodes.concat([unsupportedBlock])));
|
26
26
|
export var tableHeaderContentPseudoGroup = $onePlus($or.apply(void 0, tableCellContentNodes.concat([nestedExpand])));
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { $or, $zeroPlus, adfNode } from '@atlaskit/adf-schema-generator';
|
2
|
+
import { atomicInlineGroup } from '../groups/atomicInlineGroup';
|
2
3
|
import { inlineContentGroup } from '../groups/inlineContentGroup';
|
3
4
|
import { inlineGroup } from '../groups/inlineGroup';
|
4
5
|
import { alignment, indentation } from '../marks/alignmentAndIndentation';
|
@@ -15,7 +16,7 @@ export var paragraph = adfNode('paragraph').define({
|
|
15
16
|
selectable: false,
|
16
17
|
marks: [unsupportedNodeAttribute, unsupportedMark],
|
17
18
|
hasEmptyMarks: true,
|
18
|
-
content: [$zeroPlus($or(inlineGroup, inlineContentGroup))],
|
19
|
+
content: [$zeroPlus($or(inlineGroup, atomicInlineGroup, inlineContentGroup))],
|
19
20
|
DANGEROUS_MANUAL_OVERRIDE: {
|
20
21
|
'validator-spec': {
|
21
22
|
'props.marks': {
|
@@ -4,6 +4,6 @@ import { tableCellContentPseudoGroup } from '../groups/tableCellContentPseudoGro
|
|
4
4
|
// @DSLCompatibilityException This is only used by JSON schema to group the table cell content into a definition.
|
5
5
|
// This node should be deleted and the content should be replicated in the JSON schema for table header and table cell node
|
6
6
|
export var tableCellContent = adfNode('tableCellContent').define({
|
7
|
-
ignore: ['pm-spec'
|
7
|
+
ignore: ['pm-spec'],
|
8
8
|
content: [tableCellContentPseudoGroup]
|
9
9
|
});
|