@atlaskit/adf-schema 37.1.43 → 37.2.0

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,11 @@
1
1
  # @atlaskit/adf-schema
2
2
 
3
+ ## 37.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 5f92d0b: Added entry-point for validator spec from adf-schema package at `./schema-validator`
8
+
3
9
  ## 37.1.43
4
10
 
5
11
  ### Patch Changes
@@ -30,7 +30,7 @@ var layoutSection = exports.layoutSection = (0, _adfSchemaGenerator.adfNode)('la
30
30
  }
31
31
  }).variant('with_single_column', {
32
32
  content: [(0, _adfSchemaGenerator.$range)(1, 3, (0, _adfSchemaGenerator.$or)(_layoutColumn.layoutColumn, _unsupportedBlock.unsupportedBlock))],
33
- ignore: ['json-schema'],
33
+ ignore: [],
34
34
  DANGEROUS_MANUAL_OVERRIDE: {
35
35
  'validator-spec': {
36
36
  'props.type': {
@@ -50,7 +50,7 @@ var multiBodiedExtension = exports.multiBodiedExtension = (0, _adfSchemaGenerato
50
50
  }
51
51
  },
52
52
  content: [(0, _adfSchemaGenerator.$onePlus)((0, _adfSchemaGenerator.$or)(_extensionFrame.extensionFrame))],
53
- ignore: ['json-schema'],
53
+ ignore: [],
54
54
  DANGEROUS_MANUAL_OVERRIDE: {
55
55
  'validator-spec': {
56
56
  'props.content.minItems': {
@@ -24,7 +24,7 @@ export const 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: [],
28
28
  DANGEROUS_MANUAL_OVERRIDE: {
29
29
  'validator-spec': {
30
30
  'props.type': {
@@ -44,7 +44,7 @@ export const multiBodiedExtension = adfNode('multiBodiedExtension').define({
44
44
  }
45
45
  },
46
46
  content: [$onePlus($or(extensionFrame))],
47
- ignore: ['json-schema'],
47
+ ignore: [],
48
48
  DANGEROUS_MANUAL_OVERRIDE: {
49
49
  'validator-spec': {
50
50
  'props.content.minItems': {
@@ -24,7 +24,7 @@ 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: [],
28
28
  DANGEROUS_MANUAL_OVERRIDE: {
29
29
  'validator-spec': {
30
30
  'props.type': {
@@ -44,7 +44,7 @@ export var multiBodiedExtension = adfNode('multiBodiedExtension').define({
44
44
  }
45
45
  },
46
46
  content: [$onePlus($or(extensionFrame))],
47
- ignore: ['json-schema'],
47
+ ignore: [],
48
48
  DANGEROUS_MANUAL_OVERRIDE: {
49
49
  'validator-spec': {
50
50
  'props.content.minItems': {
@@ -29,7 +29,7 @@ export declare const layoutSection: import("@atlaskit/adf-schema-generator/dist/
29
29
  };
30
30
  } & {
31
31
  content: import("@atlaskit/adf-schema-generator/dist/types/types/ADFNodeSpec").ADFNodeContentRangeSpec[];
32
- ignore: "json-schema"[];
32
+ ignore: any[];
33
33
  DANGEROUS_MANUAL_OVERRIDE: {
34
34
  'validator-spec': {
35
35
  'props.type': {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/adf-schema",
3
- "version": "37.1.43",
3
+ "version": "37.2.0",
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,101 +40,27 @@ expect.extend({
40
40
  test('ADF DSL to JSON Schema backwards compatibility for full schema', () => {
41
41
  // eslint-disable-next-line @typescript-eslint/no-var-requires
42
42
  const currentSchema = require('../../../json-schema/v1/full.json');
43
- const nextSchema = adfToJSON(adfNode);
43
+ const nextSchema = adfToJSON(adfNode, true);
44
44
  expect(nextSchema).toBeBackwardsCompatibleWith(currentSchema);
45
45
  });
46
46
 
47
- // The end goal is to be able to remove all transformation for known failures
48
- function transformFullFixtureForKnownFailures(json) {
49
- const definitions = json.definitions;
50
-
51
- // Extra nodes in anyOf
52
- definitions.inline_node.anyOf = definitions.inline_node.anyOf.filter(
53
- (v) =>
54
- ![
55
- '#/definitions/confluenceJiraIssue_node',
56
- '#/definitions/confluenceUnsupportedInline_node',
57
- '#/definitions/image_node',
58
- '#/definitions/inlineExtension_node',
59
- '#/definitions/text_link_inline_node',
60
- '#/definitions/text_node',
61
- '#/definitions/unsupportedInline_node',
62
- ].includes(v.$ref),
63
- );
64
-
65
- // Extra nodes in content.items.anyOf
66
- definitions.table_row_node.properties.content.items.anyOf =
67
- definitions.table_row_node.properties.content.items.anyOf.filter(
68
- (v) => v.$ref !== '#/definitions/table_cell_content',
69
- );
70
-
71
- // Extra definitions
72
- delete definitions.extensionFrame_node;
73
-
74
- // // Extra marks
75
- delete definitions.date_node.properties.marks;
76
- delete definitions.emoji_node.properties.marks;
77
- delete definitions.mention_node.properties.marks;
78
- delete definitions.status_node.properties.marks;
79
-
80
- // // Extra properties
81
- delete definitions.codeBlock_node.properties.attrs.properties.uniqueId;
82
- delete definitions.codeBlock_with_marks_node.allOf.find(
83
- (v) => v.type === 'object',
84
- ).properties.content;
85
- delete definitions.mediaGroup_node.properties.attrs;
86
- delete definitions.mediaInline_node.properties.attrs.properties.url;
87
-
88
- // Special case for table_cell_content
89
- definitions.table_cell_content.items.anyOf =
90
- definitions.table_cell_content.items.anyOf.filter(
91
- (v) => v.$ref !== '#/definitions/nestedExpand_content',
92
- );
93
-
94
- return json;
95
- }
96
-
97
47
  test('JSON Schema to ADF DSL backwards compatibility for full schema', () => {
98
48
  // eslint-disable-next-line @typescript-eslint/no-var-requires
99
49
  const currentSchema = require('../../../json-schema/v1/full.json');
100
- const nextSchema = transformFullFixtureForKnownFailures(adfToJSON(adfNode));
50
+ const nextSchema = adfToJSON(adfNode, true);
101
51
  expect(currentSchema).toBeBackwardsCompatibleWith(nextSchema);
102
52
  });
103
53
 
104
- const DEFINITIONS_TO_SKIP_STAGE_0_BACKWARDS = [
105
- 'doc_node',
106
- 'inlineCard_node',
107
- 'layoutSection_with_single_column_node',
108
- 'multiBodiedExtension_node',
109
- ];
110
54
  test('ADF DSL to JSON Schema backwards compatibility for stage0 schema', () => {
111
55
  // eslint-disable-next-line @typescript-eslint/no-var-requires
112
56
  const currentSchema = require('../../../json-schema/v1/stage-0.json');
113
57
  const nextSchema = adfToJSON(adfNode);
114
- DEFINITIONS_TO_SKIP_STAGE_0_BACKWARDS.forEach((definition) => {
115
- nextSchema.definitions[definition] = currentSchema.definitions[definition];
116
- });
117
-
118
58
  expect(nextSchema).toBeBackwardsCompatibleWith(currentSchema);
119
59
  });
120
60
 
121
- const DEFINITIONS_TO_SKIP_STAGE_0_FORWARDS = [
122
- 'extensionFrame_node',
123
- 'inline_node',
124
- 'table_row_node',
125
- 'table_cell_content',
126
- 'codeBlock_node',
127
- 'codeBlock_with_marks_node',
128
- 'mediaInline_node',
129
- 'mediaGroup_node',
130
- ];
131
61
  test('JSON Schema to ADF DSL backwards compatibility for stage0 schema', () => {
132
62
  // eslint-disable-next-line @typescript-eslint/no-var-requires
133
63
  const currentSchema = require('../../../json-schema/v1/stage-0.json');
134
64
  const nextSchema = adfToJSON(adfNode);
135
- DEFINITIONS_TO_SKIP_STAGE_0_FORWARDS.forEach((definition) => {
136
- currentSchema.definitions[definition] = nextSchema.definitions[definition];
137
- });
138
-
139
65
  expect(currentSchema).toBeBackwardsCompatibleWith(nextSchema);
140
66
  });
@@ -0,0 +1,7 @@
1
+ import { doc } from '@atlaskit/adf-schema/schema-validator';
2
+
3
+ describe('ADF Validator schema entry-point', () => {
4
+ it('should have the doc node', function () {
5
+ expect(doc.props.type.values).toEqual(['doc']);
6
+ });
7
+ });
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "@atlaskit/adf-schema/schema-validator",
3
+ "description": "Validator schema generated from ADF DSL",
4
+ "main": "../dist/cjs/validator-schema/generated/validatorSpec.js",
5
+ "module": "../dist/esm/validator-schema/generated/validatorSpec.js",
6
+ "module:es2019": "../dist/es2019/validator-schema/generated/validatorSpec.js",
7
+ "sideEffects": false,
8
+ "types": "../dist/types/validator-schema/generated/validatorSpec.d.ts"
9
+ }