@atlaskit/adf-schema 37.1.39 → 37.1.41

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.
@@ -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
+ }
@@ -24,7 +24,26 @@ export var layoutSection = adfNode('layoutSection').define({
24
24
  }
25
25
  }).variant('with_single_column', {
26
26
  content: [$range(1, 3, $or(layoutColumn, unsupportedBlock))],
27
- ignore: ['json-schema']
27
+ ignore: ['json-schema'],
28
+ DANGEROUS_MANUAL_OVERRIDE: {
29
+ 'validator-spec': {
30
+ 'props.type': {
31
+ value: {
32
+ type: 'enum',
33
+ values: ['layoutSection']
34
+ },
35
+ reason: '@DSLCompatibilityException - mismatch for layoutSection_with_single_column'
36
+ },
37
+ 'props.marks': {
38
+ value: {
39
+ items: ['breakout'],
40
+ optional: true,
41
+ type: 'array'
42
+ },
43
+ reason: '@DSLCompatibilityException - mismatch for layoutSection_with_single_column'
44
+ }
45
+ }
46
+ }
28
47
  }).variant('full', {
29
48
  marks: [breakout, unsupportedNodeAttribute, unsupportedMark],
30
49
  content: [$range(2, 3, $or(layoutColumn, unsupportedBlock))],
@@ -36,7 +55,7 @@ export var layoutSection = adfNode('layoutSection').define({
36
55
  type: 'enum',
37
56
  values: ['layoutSection']
38
57
  },
39
- reason: '@DSLCompatibilityException - mismatch for layoutSection'
58
+ reason: '@DSLCompatibilityException - mismatch for layoutSection_full'
40
59
  }
41
60
  }
42
61
  }
@@ -29,7 +29,23 @@ export var nestedExpand = adfNode('nestedExpand').define({
29
29
  optional: true
30
30
  }
31
31
  },
32
- content: [$onePlus($or(codeBlock.use('with_no_marks'), paragraph.use('with_no_marks'), mediaSingle.use('caption'), mediaSingle.use('full'), taskList, bulletList, orderedList, heading.use('with_no_marks'), mediaGroup, decisionList, rule, panel, blockquote, unsupportedBlock))]
32
+ content: [$onePlus($or(codeBlock.use('with_no_marks'), paragraph.use('with_no_marks'), mediaSingle.use('caption'), mediaSingle.use('full'), taskList, bulletList, orderedList, heading.use('with_no_marks'), mediaGroup, decisionList, rule, panel, blockquote, unsupportedBlock))],
33
+ DANGEROUS_MANUAL_OVERRIDE: {
34
+ 'validator-spec': {
35
+ 'props.attrs.optional': {
36
+ remove: true,
37
+ reason: '@DSLCompatibilityException - mismatch with DSL'
38
+ },
39
+ 'props.content': {
40
+ value: 'nestedExpand_content',
41
+ reason: '@DSLCompatibilityException - mismatch with DSL'
42
+ },
43
+ required: {
44
+ reason: '@DSLCompatibilityException - required for nestedExpand validator spec',
45
+ value: ['content']
46
+ }
47
+ }
48
+ }
33
49
  }).variant('content', {
34
50
  ignore: ['pm-spec', 'validator-spec']
35
51
  }).variant('with_no_marks', {