@atlaskit/adf-schema 57.0.4 → 57.0.6

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 CHANGED
@@ -1,5 +1,52 @@
1
1
  # @atlaskit/adf-schema
2
2
 
3
+ ## 57.0.6
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 57.0.5
10
+
11
+ ### Patch Changes
12
+
13
+ - [`249ac5d9191e0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/249ac5d9191e0) -
14
+ Behind `platform_editor_adf_validator_empty_marks`, accept an explicitly empty `marks` array on a
15
+ node that ADF gives a `marks` property no mark type may go into.
16
+
17
+ ADF spells that property `marks: { type: 'array', maxItems: 0 }`, and the JSON schema accordingly
18
+ accepts `"marks": []` on `paragraph`, `heading`, `extension`, `codeBlock` and `expand`. The
19
+ spec-based validator rejected it: mark validation has nothing to reject in an empty array, so it
20
+ reported the node valid with an empty `marksValidationOutput`, which reads to the parent's
21
+ `validateChildMarks` as every mark on the child having been rejected, and the candidate spec was
22
+ declined. Without an error callback that surfaced as a thrown `undefined`; with one the document
23
+ was silently repaired and no error was reported. The five reference documents that carry
24
+ `marks: []` (`paragraph-with-empty-marks`, `heading-with-empty-marks`,
25
+ `extension-with-empty-marks`, `nestedExpand-with-codeBlock`, `panel-with-codeBlock`) were on an
26
+ ignore list in `src/validator/__tests__/unit/validate.ts` because of it, and are now validated.
27
+
28
+ A node with no `marks` property at all keeps rejecting an empty array as `REDUNDANT_MARKS`,
29
+ because `marks` is then a property ADF does not define on it: `rule`, `panel`, `mediaGroup`,
30
+ `hardBreak`, `doc`, `blockquote` and the list nodes all stay invalid, as do `mention` and `emoji`,
31
+ which declare a mark rather than an empty list. The declaration is read off the node's base spec,
32
+ since a variant only widens the mark types — `doc` offers a root `extension` as
33
+ `extension_with_marks`, which adds `dataConsumer` and `fragment`, and that cannot make the empty
34
+ list illegal.
35
+
36
+ `codeBlock` and `expand` declare `noMarks` without listing any marks, and `adfToValidatorSpec`
37
+ compared mark lists alone, so the flag was dropped and their validator specs read as taking no
38
+ `marks` property — the same thing `rule` means, which is why an empty array on them was reported
39
+ as redundant. The generator now honours `noMarks` on its own, so both emit
40
+ `marks: { type: 'array', items: [], maxItems: 0, optional: true }`, matching their JSON schema.
41
+ That part is generated data and is not gated: a real mark on a `codeBlock` or an `expand` is still
42
+ rejected, now as an unsupported mark type rather than as a redundant `marks` property, so the
43
+ error code reported for an already-invalid document changes.
44
+
45
+ Gate off preserves today's acceptance behaviour. Covered by
46
+ `src/validator/__tests__/unit/empty-marks.ts`.
47
+
48
+ - Updated dependencies
49
+
3
50
  ## 57.0.4
4
51
 
5
52
  ### Patch Changes
@@ -408,6 +408,12 @@ var codeBlock = exports.codeBlock = {
408
408
  optional: true,
409
409
  type: 'array'
410
410
  },
411
+ marks: {
412
+ items: [],
413
+ maxItems: 0,
414
+ optional: true,
415
+ type: 'array'
416
+ },
411
417
  type: {
412
418
  type: 'enum',
413
419
  values: ['codeBlock']
@@ -643,6 +649,12 @@ var expand = exports.expand = {
643
649
  minItems: 1,
644
650
  type: 'array'
645
651
  },
652
+ marks: {
653
+ items: [],
654
+ maxItems: 0,
655
+ optional: true,
656
+ type: 'array'
657
+ },
646
658
  type: {
647
659
  type: 'enum',
648
660
  values: ['expand']
@@ -402,6 +402,12 @@ export const codeBlock = {
402
402
  optional: true,
403
403
  type: 'array'
404
404
  },
405
+ marks: {
406
+ items: [],
407
+ maxItems: 0,
408
+ optional: true,
409
+ type: 'array'
410
+ },
405
411
  type: {
406
412
  type: 'enum',
407
413
  values: ['codeBlock']
@@ -637,6 +643,12 @@ export const expand = {
637
643
  minItems: 1,
638
644
  type: 'array'
639
645
  },
646
+ marks: {
647
+ items: [],
648
+ maxItems: 0,
649
+ optional: true,
650
+ type: 'array'
651
+ },
640
652
  type: {
641
653
  type: 'enum',
642
654
  values: ['expand']
@@ -402,6 +402,12 @@ export var codeBlock = {
402
402
  optional: true,
403
403
  type: 'array'
404
404
  },
405
+ marks: {
406
+ items: [],
407
+ maxItems: 0,
408
+ optional: true,
409
+ type: 'array'
410
+ },
405
411
  type: {
406
412
  type: 'enum',
407
413
  values: ['codeBlock']
@@ -637,6 +643,12 @@ export var expand = {
637
643
  minItems: 1,
638
644
  type: 'array'
639
645
  },
646
+ marks: {
647
+ items: [],
648
+ maxItems: 0,
649
+ optional: true,
650
+ type: 'array'
651
+ },
640
652
  type: {
641
653
  type: 'enum',
642
654
  values: ['expand']
@@ -412,6 +412,12 @@ export declare const codeBlock: {
412
412
  optional: boolean;
413
413
  type: string;
414
414
  };
415
+ marks: {
416
+ items: unknown[];
417
+ maxItems: number;
418
+ optional: boolean;
419
+ type: string;
420
+ };
415
421
  type: {
416
422
  type: string;
417
423
  values: string[];
@@ -647,6 +653,12 @@ export declare const expand: {
647
653
  minItems: number;
648
654
  type: string;
649
655
  };
656
+ marks: {
657
+ items: unknown[];
658
+ maxItems: number;
659
+ optional: boolean;
660
+ type: string;
661
+ };
650
662
  type: {
651
663
  type: string;
652
664
  values: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/adf-schema",
3
- "version": "57.0.4",
3
+ "version": "57.0.6",
4
4
  "description": "Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -40,7 +40,7 @@
40
40
  "@atlaskit/adf-schema-generator": "^4.0.0",
41
41
  "@atlaskit/editor-prosemirror": "^8.0.0",
42
42
  "@atlaskit/platform-feature-flags": "^2.1.0",
43
- "@atlaskit/tmp-editor-statsig": "^149.0.0",
43
+ "@atlaskit/tmp-editor-statsig": "^151.0.0",
44
44
  "@babel/runtime": "^7.0.0",
45
45
  "css-color-names": "0.0.4",
46
46
  "linkify-it": "^5.0.2",