@atlaskit/adf-schema 36.18.0 → 36.18.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/adf-schema
2
2
 
3
+ ## 36.18.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 4126ead: json schema validation for the next schema produced by adf-schema-generator
8
+
9
+ ## 36.18.1
10
+
11
+ ### Patch Changes
12
+
13
+ - 53dce02: Add autogenerated warning to the top of the autogenerated files
14
+
3
15
  ## 36.18.0
4
16
 
5
17
  ### Minor Changes
@@ -5,6 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.unsupportedNodeAttribute = exports.unsupportedMark = exports.underline = exports.textColor = exports.subsup = exports.strong = exports.strike = exports.link = exports.indentation = exports.fragment = exports.em = exports.dataConsumer = exports.code = exports.breakout = exports.border = exports.backgroundColor = exports.annotation = exports.alignment = void 0;
7
7
  var _adfSchemaGenerator = require("@atlaskit/adf-schema-generator");
8
+ /**
9
+ * This file was automatically generated by @atlaskit/adf-schema-generator
10
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source files in "packages/adf-schema/src/next-schema" ,
11
+ * and run "yarn workspace @atlaskit/adf-schema build:pm:full" to regenerate this file.
12
+ */
13
+
8
14
  var unsupportedNodeAttribute = exports.unsupportedNodeAttribute = (0, _adfSchemaGenerator.createPMMarkSpecFactory)({
9
15
  attrs: {
10
16
  type: {
@@ -5,6 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.unsupportedInline = exports.unsupportedBlock = exports.textFormatted = exports.textCodeInline = exports.text = exports.taskList = exports.taskItem = exports.tableRow = exports.tableHeader = exports.tableCell = exports.table = exports.status = exports.rule = exports.placeholder = exports.paragraphWithNoMarks = exports.paragraphWithMarks = exports.paragraphWithAlignment = exports.paragraph = exports.panel = exports.orderedList = exports.nestedExpandWithNoMarks = exports.multiBodiedExtension = exports.mention = exports.mediaSingleFull = exports.mediaSingleCaption = exports.mediaSingle = exports.mediaInline = exports.mediaGroup = exports.media = exports.listItem = exports.layoutSection = exports.layoutColumn = exports.inlineExtensionWithMarks = exports.inlineCard = exports.image = exports.headingWithNoMarks = exports.headingWithIndentation = exports.headingWithAlignment = exports.heading = exports.hardBreak = exports.extensionWithMarks = exports.extensionFrame = exports.extension = exports.expandWithNoMark = exports.emoji = exports.embedCard = exports.doc = exports.decisionList = exports.decisionItem = exports.date = exports.confluenceUnsupportedInline = exports.confluenceUnsupportedBlock = exports.confluenceJiraIssue = exports.codeBlockWithNoMarks = exports.codeBlock = exports.caption = exports.bulletList = exports.bodiedExtensionWithMarks = exports.bodiedExtension = exports.blockquoteWithList = exports.blockquote = exports.blockCard = void 0;
7
7
  var _adfSchemaGenerator = require("@atlaskit/adf-schema-generator");
8
+ /**
9
+ * This file was automatically generated by @atlaskit/adf-schema-generator
10
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source files in "packages/adf-schema/src/next-schema" ,
11
+ * and run "yarn workspace @atlaskit/adf-schema build:pm:full" to regenerate this file.
12
+ */
13
+
8
14
  var text = exports.text = (0, _adfSchemaGenerator.createPMNodeSpecFactory)({
9
15
  group: 'inline'
10
16
  });
@@ -1,3 +1,9 @@
1
+ /**
2
+ * This file was automatically generated by @atlaskit/adf-schema-generator
3
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source files in "packages/adf-schema/src/next-schema" ,
4
+ * and run "yarn workspace @atlaskit/adf-schema build:pm:full" to regenerate this file.
5
+ */
6
+
1
7
  import { createPMMarkSpecFactory } from '@atlaskit/adf-schema-generator';
2
8
  export const unsupportedNodeAttribute = createPMMarkSpecFactory({
3
9
  attrs: {
@@ -1,3 +1,9 @@
1
+ /**
2
+ * This file was automatically generated by @atlaskit/adf-schema-generator
3
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source files in "packages/adf-schema/src/next-schema" ,
4
+ * and run "yarn workspace @atlaskit/adf-schema build:pm:full" to regenerate this file.
5
+ */
6
+
1
7
  import { createPMNodeSpecFactory } from '@atlaskit/adf-schema-generator';
2
8
  export const text = createPMNodeSpecFactory({
3
9
  group: 'inline'
@@ -1,3 +1,9 @@
1
+ /**
2
+ * This file was automatically generated by @atlaskit/adf-schema-generator
3
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source files in "packages/adf-schema/src/next-schema" ,
4
+ * and run "yarn workspace @atlaskit/adf-schema build:pm:full" to regenerate this file.
5
+ */
6
+
1
7
  import { createPMMarkSpecFactory } from '@atlaskit/adf-schema-generator';
2
8
  export var unsupportedNodeAttribute = createPMMarkSpecFactory({
3
9
  attrs: {
@@ -1,3 +1,9 @@
1
+ /**
2
+ * This file was automatically generated by @atlaskit/adf-schema-generator
3
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source files in "packages/adf-schema/src/next-schema" ,
4
+ * and run "yarn workspace @atlaskit/adf-schema build:pm:full" to regenerate this file.
5
+ */
6
+
1
7
  import { createPMNodeSpecFactory } from '@atlaskit/adf-schema-generator';
2
8
  export var text = createPMNodeSpecFactory({
3
9
  group: 'inline'
@@ -1,3 +1,8 @@
1
+ /**
2
+ * This file was automatically generated by @atlaskit/adf-schema-generator
3
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source files in "packages/adf-schema/src/next-schema" ,
4
+ * and run "yarn workspace @atlaskit/adf-schema build:pm:full" to regenerate this file.
5
+ */
1
6
  import { Mark } from '@atlaskit/editor-prosemirror/model';
2
7
  export interface UnsupportedNodeAttributeMarkAttributes {
3
8
  type: string;
@@ -1,3 +1,8 @@
1
+ /**
2
+ * This file was automatically generated by @atlaskit/adf-schema-generator
3
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source files in "packages/adf-schema/src/next-schema" ,
4
+ * and run "yarn workspace @atlaskit/adf-schema build:pm:full" to regenerate this file.
5
+ */
1
6
  import { TextDefinition, TextFormattedDefinition, TextCodeInlineDefinition, DateDefinition, EmojiDefinition, HardBreakDefinition, InlineCardDefinition, MentionDefinition, PlaceholderDefinition, StatusDefinition, InlineExtensionWithMarksDefinition, MediaInlineDefinition, ImageDefinition, ConfluenceJiraIssueDefinition, ConfluenceUnsupportedInlineDefinition, UnsupportedInlineDefinition } from './nodeTypes';
2
7
  export type InlineDefinition = Array<TextDefinition | TextFormattedDefinition | TextCodeInlineDefinition | DateDefinition | EmojiDefinition | HardBreakDefinition | InlineCardDefinition | MentionDefinition | PlaceholderDefinition | StatusDefinition | InlineExtensionWithMarksDefinition | MediaInlineDefinition | ImageDefinition | ConfluenceJiraIssueDefinition | ConfluenceUnsupportedInlineDefinition | UnsupportedInlineDefinition>;
3
8
  import { PanelDefinition, ParagraphDefinition, ParagraphWithMarksDefinition, BlockquoteWithListDefinition, OrderedListDefinition, BulletListDefinition, RuleDefinition, HeadingWithNoMarksDefinition, HeadingWithAlignmentDefinition, HeadingWithIndentationDefinition, CodeBlockWithNoMarksDefinition, MediaGroupDefinition, MediaSingleCaptionDefinition, MediaSingleFullDefinition, DecisionListDefinition, TaskListDefinition, TableDefinition, ExpandWithNoMarkDefinition, ExtensionWithMarksDefinition, BodiedExtensionWithMarksDefinition, BlockCardDefinition, EmbedCardDefinition, ConfluenceUnsupportedBlockDefinition, UnsupportedBlockDefinition } from './nodeTypes';
@@ -1,3 +1,8 @@
1
+ /**
2
+ * This file was automatically generated by @atlaskit/adf-schema-generator
3
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source files in "packages/adf-schema/src/next-schema" ,
4
+ * and run "yarn workspace @atlaskit/adf-schema build:pm:full" to regenerate this file.
5
+ */
1
6
  import { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
7
  import { InlineDefinition, BlockDefinition, BlockRootOnlyDefinition } from './nodeGroupTypes';
3
8
  import { UnsupportedNodeAttributeMark, UnsupportedMarkMark, LinkMark, EmMark, StrongMark, StrikeMark, SubsupMark, UnderlineMark, TextColorMark, AnnotationMark, BackgroundColorMark, CodeMark, DataConsumerMark, FragmentMark, BorderMark, AlignmentMark, IndentationMark, BreakoutMark } from './markTypes';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/adf-schema",
3
- "version": "36.18.0",
3
+ "version": "36.18.2",
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/"
@@ -44,7 +44,7 @@
44
44
  },
45
45
  "devDependencies": {
46
46
  "@atlassian/adf-schema-json": "^1.15.0",
47
- "@atlaskit/adf-schema-generator": "^1.17.0",
47
+ "@atlaskit/adf-schema-generator": "^1.17.1",
48
48
  "@atlaskit/codemod-utils": "^4.2.4",
49
49
  "@atlaskit/json-schema-generator": "^3.3.9",
50
50
  "@babel/cli": "^7.22.9",
@@ -66,6 +66,7 @@
66
66
  "cross-env": "^7.0.3",
67
67
  "jest": "^29.6.2",
68
68
  "jest-environment-jsdom": "^29.6.2",
69
+ "json-schema-diff-validator": "^0.4.1",
69
70
  "prop-types": "^15.5.4",
70
71
  "react": "^16.8.0",
71
72
  "react-dom": "^16.8.0",
@@ -0,0 +1,129 @@
1
+ import { validateSchemaCompatibility } from 'json-schema-diff-validator';
2
+ import { adfToJSON } from '@atlaskit/adf-schema-generator';
3
+ import adfNode from '@atlaskit/adf-schema/src/next-schema/full-schema.adf';
4
+
5
+ const DEFINITIONS_TO_SKIP_FULL = [
6
+ 'blockCard_node',
7
+ 'block_content',
8
+ 'bodiedExtension_node',
9
+ 'bodiedExtension_with_marks_node',
10
+ 'codeBlock_node',
11
+ 'codeBlock_with_marks_node',
12
+ 'codeBlock_with_no_marks_node',
13
+ 'code_inline_node',
14
+ 'doc_node',
15
+ 'expand_node',
16
+ 'expand_with_breakout_mark_node',
17
+ 'expand_with_no_mark_node',
18
+ 'extension_node',
19
+ 'extension_with_marks_node',
20
+ 'formatted_text_inline_node',
21
+ 'heading_node',
22
+ 'heading_with_alignment_node',
23
+ 'heading_with_indentation_node',
24
+ 'heading_with_no_marks_node',
25
+ 'inlineCard_node',
26
+ 'inlineExtension_node',
27
+ 'inlineExtension_with_marks_node',
28
+ 'inline_node',
29
+ 'layoutSection_full_node',
30
+ 'mediaInline_node',
31
+ 'mediaSingle_caption_node',
32
+ 'mediaSingle_full_node',
33
+ 'mediaSingle_node',
34
+ 'nestedExpand_content',
35
+ 'nestedExpand_node',
36
+ 'nestedExpand_with_no_marks_node',
37
+ 'non_nestable_block_content',
38
+ 'paragraph_node',
39
+ 'paragraph_with_alignment_node',
40
+ 'paragraph_with_indentation_node',
41
+ 'paragraph_with_no_marks_node',
42
+ 'table_cell_content',
43
+ 'table_cell_node',
44
+ 'table_header_node',
45
+ 'text_node',
46
+ ];
47
+
48
+ test('ADF DSL to JSON Schema backwards compatibility for full schema', () => {
49
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
50
+ const currentSchema = require('../../../json-schema/v1/full.json');
51
+ const nextSchema = adfToJSON(adfNode);
52
+ DEFINITIONS_TO_SKIP_FULL.forEach((definition) => {
53
+ nextSchema.definitions[definition] = currentSchema.definitions[definition];
54
+ });
55
+
56
+ expect(() => {
57
+ validateSchemaCompatibility(currentSchema, nextSchema, {
58
+ allowNewOneOf: true,
59
+ allowNewEnumValue: true,
60
+ allowReorder: true,
61
+ });
62
+ }).not.toThrow();
63
+ });
64
+
65
+ const DEFINITIONS_TO_SKIP_STAGE_0 = [
66
+ 'blockCard_node',
67
+ 'block_content',
68
+ 'bodiedExtension_node',
69
+ 'bodiedExtension_with_marks_node',
70
+ 'codeBlock_node',
71
+ 'codeBlock_with_marks_node',
72
+ 'codeBlock_with_no_marks_node',
73
+ 'code_inline_node',
74
+ 'date_node',
75
+ 'doc_node',
76
+ 'emoji_node',
77
+ 'expand_node',
78
+ 'expand_with_breakout_mark_node',
79
+ 'expand_with_no_mark_node',
80
+ 'extensionFrame_node',
81
+ 'extension_node',
82
+ 'extension_with_marks_node',
83
+ 'formatted_text_inline_node',
84
+ 'heading_node',
85
+ 'heading_with_alignment_node',
86
+ 'heading_with_indentation_node',
87
+ 'heading_with_no_marks_node',
88
+ 'inlineCard_node',
89
+ 'inlineExtension_node',
90
+ 'inlineExtension_with_marks_node',
91
+ 'inline_node',
92
+ 'layoutSection_full_node',
93
+ 'layoutSection_with_single_column_node',
94
+ 'mediaInline_node',
95
+ 'mediaSingle_caption_node',
96
+ 'mediaSingle_full_node',
97
+ 'mediaSingle_node',
98
+ 'mention_node',
99
+ 'multiBodiedExtension_node',
100
+ 'nestedExpand_content',
101
+ 'nestedExpand_node',
102
+ 'nestedExpand_with_no_marks_node',
103
+ 'non_nestable_block_content',
104
+ 'paragraph_node',
105
+ 'paragraph_with_alignment_node',
106
+ 'paragraph_with_indentation_node',
107
+ 'paragraph_with_no_marks_node',
108
+ 'status_node',
109
+ 'table_cell_content',
110
+ 'table_cell_node',
111
+ 'table_header_node',
112
+ 'text_node',
113
+ ];
114
+ test('ADF DSL to JSON Schema backwards compatibility for stage0 schema', () => {
115
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
116
+ const currentSchema = require('../../../json-schema/v1/stage-0.json');
117
+ const nextSchema = adfToJSON(adfNode);
118
+ DEFINITIONS_TO_SKIP_STAGE_0.forEach((definition) => {
119
+ nextSchema.definitions[definition] = currentSchema.definitions[definition];
120
+ });
121
+
122
+ expect(() => {
123
+ validateSchemaCompatibility(currentSchema, nextSchema, {
124
+ allowNewOneOf: true,
125
+ allowNewEnumValue: true,
126
+ allowReorder: true,
127
+ });
128
+ }).not.toThrow();
129
+ });