@squiz/dx-json-schema-lib 1.77.0 → 1.78.1
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/lib/JsonValidationService.spec.js +160 -0
- package/lib/JsonValidationService.spec.js.map +1 -1
- package/lib/formatted-text/v1/formattedText.d.ts +19 -0
- package/lib/formatted-text/v1/formattedText.json +52 -3
- package/lib/manifest/v1/JobV1.d.ts +14 -14
- package/lib/manifest/v1/manifestModels.d.ts +1 -0
- package/lib/manifest/v1/manifestModels.js +2 -1
- package/lib/manifest/v1/manifestModels.js.map +1 -1
- package/lib/manifest/v1/v1.d.ts +28 -28
- package/package.json +2 -2
- package/src/JsonValidationService.spec.ts +172 -0
- package/src/formatted-text/v1/formattedText.json +52 -3
- package/src/formatted-text/v1/formattedText.ts +19 -0
- package/src/manifest/v1/JobV1.ts +14 -14
- package/src/manifest/v1/manifestModels.ts +1 -0
- package/src/manifest/v1/v1.ts +28 -28
- package/tsconfig.tsbuildinfo +1 -1
@@ -23,6 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
23
23
|
return result;
|
24
24
|
};
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
-
exports.v1 = void 0;
|
26
|
+
exports.JobV1 = exports.v1 = void 0;
|
27
27
|
exports.v1 = __importStar(require("./v1"));
|
28
|
+
exports.JobV1 = __importStar(require("./JobV1"));
|
28
29
|
//# sourceMappingURL=manifestModels.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"manifestModels.js","sourceRoot":"","sources":["../../../src/manifest/v1/manifestModels.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA2B"}
|
1
|
+
{"version":3,"file":"manifestModels.js","sourceRoot":"","sources":["../../../src/manifest/v1/manifestModels.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA2B;AAC3B,iDAAiC"}
|
package/lib/manifest/v1/v1.d.ts
CHANGED
@@ -37,26 +37,26 @@ export type CoreSchemaMetaSchema2 = {
|
|
37
37
|
$comment?: string;
|
38
38
|
title?: string;
|
39
39
|
description?: string;
|
40
|
-
default?:
|
40
|
+
default?: unknown;
|
41
41
|
readOnly?: boolean;
|
42
42
|
writeOnly?: boolean;
|
43
|
-
examples?:
|
43
|
+
examples?: unknown[];
|
44
44
|
multipleOf?: number;
|
45
45
|
maximum?: number;
|
46
46
|
exclusiveMaximum?: number;
|
47
47
|
minimum?: number;
|
48
48
|
exclusiveMinimum?: number;
|
49
49
|
maxLength?: number;
|
50
|
-
minLength?: number
|
50
|
+
minLength?: number;
|
51
51
|
pattern?: string;
|
52
52
|
additionalItems?: CoreSchemaMetaSchema2;
|
53
53
|
items?: CoreSchemaMetaSchema2 | SchemaArray;
|
54
54
|
maxItems?: number;
|
55
|
-
minItems?: number
|
55
|
+
minItems?: number;
|
56
56
|
uniqueItems?: boolean;
|
57
57
|
contains?: CoreSchemaMetaSchema2;
|
58
58
|
maxProperties?: number;
|
59
|
-
minProperties?: number
|
59
|
+
minProperties?: number;
|
60
60
|
required?: StringArray;
|
61
61
|
additionalProperties?: CoreSchemaMetaSchema2;
|
62
62
|
definitions?: {
|
@@ -72,11 +72,11 @@ export type CoreSchemaMetaSchema2 = {
|
|
72
72
|
[k: string]: CoreSchemaMetaSchema2 | StringArray;
|
73
73
|
};
|
74
74
|
propertyNames?: CoreSchemaMetaSchema2;
|
75
|
-
const?:
|
75
|
+
const?: unknown;
|
76
76
|
/**
|
77
77
|
* @minItems 1
|
78
78
|
*/
|
79
|
-
enum?:
|
79
|
+
enum?: unknown[];
|
80
80
|
type?: ('array' | 'boolean' | 'integer' | 'null' | 'number' | 'object' | 'string' | 'FormattedText' | 'SquizImage' | 'SquizLink') | ('array' | 'boolean' | 'integer' | 'null' | 'number' | 'object' | 'string' | 'FormattedText' | 'SquizImage' | 'SquizLink')[];
|
81
81
|
format?: 'date-time' | 'email' | 'hostname' | 'ipv4' | 'ipv6' | 'json-pointer' | 'matrix-asset-uri' | 'multi-line' | 'password' | 'phone' | 'regex' | 'relative-json-pointer' | 'uri-reference' | 'uri-template' | 'uri' | 'uuid';
|
82
82
|
matrixAssetTypes?: ('audioFile' | 'bodycopyContainer' | 'bodycopyDiv' | 'calendarEventsSearchPage' | 'contentContainerTemplate' | 'contentTypeMarkdown' | 'contentTypeNestContent' | 'contentTypeRawHtml' | 'contentTypeSnippet' | 'contentTypeWysiwyg' | 'cssFileFolder' | 'cssFile' | 'customForm' | 'dataRecord' | 'designAreaAssetLineage' | 'designAreaBody' | 'designAreaMenuNormal' | 'designAreaNestContent' | 'designCssCustomisation' | 'designCss' | 'designCustomisation' | 'designScss' | 'design' | 'docx' | 'excelDoc' | 'file' | 'folder' | 'gitBridge' | 'googleAnalyticsConnector' | 'googleAnalyticsView' | 'image' | 'jsFileFolder' | 'jsFile' | 'jsonWebToken' | 'layoutManager' | 'layout' | 'link' | 'metadataFieldDate' | 'metadataFieldRelatedAsset' | 'metadataFieldSelect' | 'metadataFieldText' | 'metadataFieldWysiwyg' | 'metadataSchema' | 'metadataSection' | 'newsItem' | 'oauthAccountManager' | 'pageAccountManager' | 'pageAssetListing' | 'pageCalendarEventsSearch' | 'pageCalendar' | 'pagePasswordReset' | 'pageRemoteContent' | 'pageRestResourceJs' | 'pageRestResourceOauthSession' | 'pageRestResourceOauthTwoLegged' | 'pageRestResource' | 'pageSiteMap' | 'pageStandard' | 'paintLayoutBodycopy' | 'paintLayoutPage' | 'pdfFile' | 'pdf' | 'persona' | 'powerpointDoc' | 'pptx' | 'redirectPage' | 'regex' | 'regularExpression' | 'rtfFile' | 'samlAccountManager' | 'saml2Acs' | 'saml2Sls' | 'searchPage' | 'site' | 'textFile' | 'TriggerTypes?' | 'userGroup' | 'wordDoc' | 'workflowSchema' | 'workflowStepCondition' | 'workflowStep' | 'workflowStream' | 'xlsx' | 'xmlFile')[];
|
@@ -103,26 +103,26 @@ export type CoreSchemaMetaSchema5 = {
|
|
103
103
|
$comment?: string;
|
104
104
|
title?: string;
|
105
105
|
description?: string;
|
106
|
-
default?:
|
106
|
+
default?: unknown;
|
107
107
|
readOnly?: boolean;
|
108
108
|
writeOnly?: boolean;
|
109
|
-
examples?:
|
109
|
+
examples?: unknown[];
|
110
110
|
multipleOf?: number;
|
111
111
|
maximum?: number;
|
112
112
|
exclusiveMaximum?: number;
|
113
113
|
minimum?: number;
|
114
114
|
exclusiveMinimum?: number;
|
115
115
|
maxLength?: number;
|
116
|
-
minLength?: number
|
116
|
+
minLength?: number;
|
117
117
|
pattern?: string;
|
118
118
|
additionalItems?: CoreSchemaMetaSchema5;
|
119
119
|
items?: CoreSchemaMetaSchema5 | SchemaArray1;
|
120
120
|
maxItems?: number;
|
121
|
-
minItems?: number
|
121
|
+
minItems?: number;
|
122
122
|
uniqueItems?: boolean;
|
123
123
|
contains?: CoreSchemaMetaSchema5;
|
124
124
|
maxProperties?: number;
|
125
|
-
minProperties?: number
|
125
|
+
minProperties?: number;
|
126
126
|
required?: StringArray1;
|
127
127
|
additionalProperties?: CoreSchemaMetaSchema5;
|
128
128
|
definitions?: {
|
@@ -138,11 +138,11 @@ export type CoreSchemaMetaSchema5 = {
|
|
138
138
|
[k: string]: CoreSchemaMetaSchema5 | StringArray1;
|
139
139
|
};
|
140
140
|
propertyNames?: CoreSchemaMetaSchema5;
|
141
|
-
const?:
|
141
|
+
const?: unknown;
|
142
142
|
/**
|
143
143
|
* @minItems 1
|
144
144
|
*/
|
145
|
-
enum?:
|
145
|
+
enum?: unknown[];
|
146
146
|
type?: ('array' | 'boolean' | 'integer' | 'null' | 'number' | 'object' | 'string') | ('array' | 'boolean' | 'integer' | 'null' | 'number' | 'object' | 'string')[];
|
147
147
|
format?: string;
|
148
148
|
contentMediaType?: string;
|
@@ -290,26 +290,26 @@ export interface CoreSchemaMetaSchema1 {
|
|
290
290
|
$comment?: string;
|
291
291
|
title?: string;
|
292
292
|
description?: string;
|
293
|
-
default?:
|
293
|
+
default?: unknown;
|
294
294
|
readOnly?: boolean;
|
295
295
|
writeOnly?: boolean;
|
296
|
-
examples?:
|
296
|
+
examples?: unknown[];
|
297
297
|
multipleOf?: number;
|
298
298
|
maximum?: number;
|
299
299
|
exclusiveMaximum?: number;
|
300
300
|
minimum?: number;
|
301
301
|
exclusiveMinimum?: number;
|
302
302
|
maxLength?: number;
|
303
|
-
minLength?: number
|
303
|
+
minLength?: number;
|
304
304
|
pattern?: string;
|
305
305
|
additionalItems?: CoreSchemaMetaSchema2;
|
306
306
|
items?: CoreSchemaMetaSchema2 | SchemaArray;
|
307
307
|
maxItems?: number;
|
308
|
-
minItems?: number
|
308
|
+
minItems?: number;
|
309
309
|
uniqueItems?: boolean;
|
310
310
|
contains?: CoreSchemaMetaSchema2;
|
311
311
|
maxProperties?: number;
|
312
|
-
minProperties?: number
|
312
|
+
minProperties?: number;
|
313
313
|
required?: StringArray;
|
314
314
|
additionalProperties?: CoreSchemaMetaSchema2;
|
315
315
|
definitions?: {
|
@@ -325,11 +325,11 @@ export interface CoreSchemaMetaSchema1 {
|
|
325
325
|
[k: string]: CoreSchemaMetaSchema2 | StringArray;
|
326
326
|
};
|
327
327
|
propertyNames?: CoreSchemaMetaSchema2;
|
328
|
-
const?:
|
328
|
+
const?: unknown;
|
329
329
|
/**
|
330
330
|
* @minItems 1
|
331
331
|
*/
|
332
|
-
enum?:
|
332
|
+
enum?: unknown[];
|
333
333
|
type?: ('array' | 'boolean' | 'integer' | 'null' | 'number' | 'object' | 'string' | 'FormattedText' | 'SquizImage' | 'SquizLink') | ('array' | 'boolean' | 'integer' | 'null' | 'number' | 'object' | 'string' | 'FormattedText' | 'SquizImage' | 'SquizLink')[];
|
334
334
|
format?: 'date-time' | 'email' | 'hostname' | 'ipv4' | 'ipv6' | 'json-pointer' | 'matrix-asset-uri' | 'multi-line' | 'password' | 'phone' | 'regex' | 'relative-json-pointer' | 'uri-reference' | 'uri-template' | 'uri' | 'uuid';
|
335
335
|
matrixAssetTypes?: ('audioFile' | 'bodycopyContainer' | 'bodycopyDiv' | 'calendarEventsSearchPage' | 'contentContainerTemplate' | 'contentTypeMarkdown' | 'contentTypeNestContent' | 'contentTypeRawHtml' | 'contentTypeSnippet' | 'contentTypeWysiwyg' | 'cssFileFolder' | 'cssFile' | 'customForm' | 'dataRecord' | 'designAreaAssetLineage' | 'designAreaBody' | 'designAreaMenuNormal' | 'designAreaNestContent' | 'designCssCustomisation' | 'designCss' | 'designCustomisation' | 'designScss' | 'design' | 'docx' | 'excelDoc' | 'file' | 'folder' | 'gitBridge' | 'googleAnalyticsConnector' | 'googleAnalyticsView' | 'image' | 'jsFileFolder' | 'jsFile' | 'jsonWebToken' | 'layoutManager' | 'layout' | 'link' | 'metadataFieldDate' | 'metadataFieldRelatedAsset' | 'metadataFieldSelect' | 'metadataFieldText' | 'metadataFieldWysiwyg' | 'metadataSchema' | 'metadataSection' | 'newsItem' | 'oauthAccountManager' | 'pageAccountManager' | 'pageAssetListing' | 'pageCalendarEventsSearch' | 'pageCalendar' | 'pagePasswordReset' | 'pageRemoteContent' | 'pageRestResourceJs' | 'pageRestResourceOauthSession' | 'pageRestResourceOauthTwoLegged' | 'pageRestResource' | 'pageSiteMap' | 'pageStandard' | 'paintLayoutBodycopy' | 'paintLayoutPage' | 'pdfFile' | 'pdf' | 'persona' | 'powerpointDoc' | 'pptx' | 'redirectPage' | 'regex' | 'regularExpression' | 'rtfFile' | 'samlAccountManager' | 'saml2Acs' | 'saml2Sls' | 'searchPage' | 'site' | 'textFile' | 'TriggerTypes?' | 'userGroup' | 'wordDoc' | 'workflowSchema' | 'workflowStepCondition' | 'workflowStep' | 'workflowStream' | 'xlsx' | 'xmlFile')[];
|
@@ -395,26 +395,26 @@ export interface CoreSchemaMetaSchema4 {
|
|
395
395
|
$comment?: string;
|
396
396
|
title?: string;
|
397
397
|
description?: string;
|
398
|
-
default?:
|
398
|
+
default?: unknown;
|
399
399
|
readOnly?: boolean;
|
400
400
|
writeOnly?: boolean;
|
401
|
-
examples?:
|
401
|
+
examples?: unknown[];
|
402
402
|
multipleOf?: number;
|
403
403
|
maximum?: number;
|
404
404
|
exclusiveMaximum?: number;
|
405
405
|
minimum?: number;
|
406
406
|
exclusiveMinimum?: number;
|
407
407
|
maxLength?: number;
|
408
|
-
minLength?: number
|
408
|
+
minLength?: number;
|
409
409
|
pattern?: string;
|
410
410
|
additionalItems?: CoreSchemaMetaSchema5;
|
411
411
|
items?: CoreSchemaMetaSchema5 | SchemaArray1;
|
412
412
|
maxItems?: number;
|
413
|
-
minItems?: number
|
413
|
+
minItems?: number;
|
414
414
|
uniqueItems?: boolean;
|
415
415
|
contains?: CoreSchemaMetaSchema5;
|
416
416
|
maxProperties?: number;
|
417
|
-
minProperties?: number
|
417
|
+
minProperties?: number;
|
418
418
|
required?: StringArray1;
|
419
419
|
additionalProperties?: CoreSchemaMetaSchema5;
|
420
420
|
definitions?: {
|
@@ -430,11 +430,11 @@ export interface CoreSchemaMetaSchema4 {
|
|
430
430
|
[k: string]: CoreSchemaMetaSchema5 | StringArray1;
|
431
431
|
};
|
432
432
|
propertyNames?: CoreSchemaMetaSchema5;
|
433
|
-
const?:
|
433
|
+
const?: unknown;
|
434
434
|
/**
|
435
435
|
* @minItems 1
|
436
436
|
*/
|
437
|
-
enum?:
|
437
|
+
enum?: unknown[];
|
438
438
|
type?: ('array' | 'boolean' | 'integer' | 'null' | 'number' | 'object' | 'string') | ('array' | 'boolean' | 'integer' | 'null' | 'number' | 'object' | 'string')[];
|
439
439
|
format?: string;
|
440
440
|
contentMediaType?: string;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@squiz/dx-json-schema-lib",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.78.1",
|
4
4
|
"description": "",
|
5
5
|
"main": "lib/index.js",
|
6
6
|
"private": false,
|
@@ -23,7 +23,7 @@
|
|
23
23
|
"@types/node": "20.12.12",
|
24
24
|
"dotenv": "16.0.3",
|
25
25
|
"jest": "29.4.1",
|
26
|
-
"json-schema-to-typescript": "
|
26
|
+
"json-schema-to-typescript": "14.1.0",
|
27
27
|
"rimraf": "5.0.7",
|
28
28
|
"ts-jest": "29.0.5",
|
29
29
|
"ts-loader": "9.3.1",
|
@@ -1060,6 +1060,178 @@ describe('JsonSchemaService', () => {
|
|
1060
1060
|
|
1061
1061
|
expect(jsonSchemaService.validateInput({ 'my-input': [] }, schema)).toEqual(true);
|
1062
1062
|
});
|
1063
|
+
|
1064
|
+
it.each([
|
1065
|
+
['with attributes', { title: 'Link title' }],
|
1066
|
+
['without attributes', undefined],
|
1067
|
+
])('should validate link-to-matrix-asset - %s', (_: string, attributes?: Record<string, string>) => {
|
1068
|
+
const formattedText: FormattedText = [
|
1069
|
+
{
|
1070
|
+
type: 'link-to-matrix-asset',
|
1071
|
+
matrixIdentifier: 'matrix-identifier',
|
1072
|
+
matrixDomain: 'https://matrix-api-url',
|
1073
|
+
target: '_blank',
|
1074
|
+
matrixAssetId: '12345',
|
1075
|
+
children: [{ type: 'text', value: 'hello' }],
|
1076
|
+
attributes,
|
1077
|
+
},
|
1078
|
+
];
|
1079
|
+
const schema = {
|
1080
|
+
type: 'object',
|
1081
|
+
properties: {
|
1082
|
+
myInput: {
|
1083
|
+
type: 'FormattedText',
|
1084
|
+
},
|
1085
|
+
},
|
1086
|
+
};
|
1087
|
+
const value = {
|
1088
|
+
myInput: formattedText,
|
1089
|
+
};
|
1090
|
+
|
1091
|
+
expect(jsonSchemaService.validateInput(value, schema)).toBe(true);
|
1092
|
+
});
|
1093
|
+
|
1094
|
+
it('should throw if link-to-matrix-asset contains a reserved attribute', () => {
|
1095
|
+
const formattedText: FormattedText = [
|
1096
|
+
{
|
1097
|
+
type: 'link-to-matrix-asset',
|
1098
|
+
matrixIdentifier: 'matrix-identifier',
|
1099
|
+
matrixDomain: 'https://matrix-api-url',
|
1100
|
+
target: '_blank',
|
1101
|
+
matrixAssetId: '12345',
|
1102
|
+
children: [{ type: 'text', value: 'hello' }],
|
1103
|
+
attributes: {
|
1104
|
+
// href is reserved (resolved from the selected Matrix asset)
|
1105
|
+
href: 'https://www.my-matrix.squiz.net',
|
1106
|
+
} as any,
|
1107
|
+
},
|
1108
|
+
];
|
1109
|
+
const schema = {
|
1110
|
+
type: 'object',
|
1111
|
+
properties: {
|
1112
|
+
myInput: {
|
1113
|
+
type: 'FormattedText',
|
1114
|
+
},
|
1115
|
+
},
|
1116
|
+
};
|
1117
|
+
const value = {
|
1118
|
+
myInput: formattedText,
|
1119
|
+
};
|
1120
|
+
|
1121
|
+
expect(() => jsonSchemaService.validateInput(value, schema)).toThrow(/does not match any given oneof schema/);
|
1122
|
+
});
|
1123
|
+
|
1124
|
+
it.each([
|
1125
|
+
['with attributes', { title: 'Link title' }],
|
1126
|
+
['without attributes', undefined],
|
1127
|
+
])('should validate matrix-image - %s', (_: string, attributes?: Record<string, string>) => {
|
1128
|
+
const formattedText: FormattedText = [
|
1129
|
+
{
|
1130
|
+
type: 'matrix-image',
|
1131
|
+
matrixIdentifier: 'matrix-identifier',
|
1132
|
+
matrixDomain: 'https://matrix-api-url',
|
1133
|
+
matrixAssetId: '12345',
|
1134
|
+
attributes,
|
1135
|
+
},
|
1136
|
+
];
|
1137
|
+
const schema = {
|
1138
|
+
type: 'object',
|
1139
|
+
properties: {
|
1140
|
+
myInput: {
|
1141
|
+
type: 'FormattedText',
|
1142
|
+
},
|
1143
|
+
},
|
1144
|
+
};
|
1145
|
+
const value = {
|
1146
|
+
myInput: formattedText,
|
1147
|
+
};
|
1148
|
+
|
1149
|
+
expect(jsonSchemaService.validateInput(value, schema)).toBe(true);
|
1150
|
+
});
|
1151
|
+
|
1152
|
+
it('should throw if matrix-image contains a reserved attribute', () => {
|
1153
|
+
const formattedText: FormattedText = [
|
1154
|
+
{
|
1155
|
+
type: 'matrix-image',
|
1156
|
+
matrixIdentifier: 'matrix-identifier',
|
1157
|
+
matrixDomain: 'https://matrix-api-url',
|
1158
|
+
matrixAssetId: '12345',
|
1159
|
+
attributes: {
|
1160
|
+
// src is reserved (resolved from the selected Matrix asset)
|
1161
|
+
src: 'https://www.my-matrix.squiz.net/image.png',
|
1162
|
+
} as any,
|
1163
|
+
},
|
1164
|
+
];
|
1165
|
+
const schema = {
|
1166
|
+
type: 'object',
|
1167
|
+
properties: {
|
1168
|
+
myInput: {
|
1169
|
+
type: 'FormattedText',
|
1170
|
+
},
|
1171
|
+
},
|
1172
|
+
};
|
1173
|
+
const value = {
|
1174
|
+
myInput: formattedText,
|
1175
|
+
};
|
1176
|
+
|
1177
|
+
expect(() => jsonSchemaService.validateInput(value, schema)).toThrow(/does not match any given oneof schema/);
|
1178
|
+
});
|
1179
|
+
|
1180
|
+
it.each([
|
1181
|
+
['with attributes', { title: 'Link title' }],
|
1182
|
+
['without attributes', undefined],
|
1183
|
+
])('should validate dam-image - %s', (_: string, attributes?: Record<string, string>) => {
|
1184
|
+
const formattedText: FormattedText = [
|
1185
|
+
{
|
1186
|
+
type: 'dam-image',
|
1187
|
+
damSystemIdentifier: 'dam-identifier',
|
1188
|
+
damObjectId: '12345',
|
1189
|
+
damSystemType: 'bynder',
|
1190
|
+
attributes,
|
1191
|
+
},
|
1192
|
+
];
|
1193
|
+
const schema = {
|
1194
|
+
type: 'object',
|
1195
|
+
properties: {
|
1196
|
+
myInput: {
|
1197
|
+
type: 'FormattedText',
|
1198
|
+
},
|
1199
|
+
},
|
1200
|
+
};
|
1201
|
+
const value = {
|
1202
|
+
myInput: formattedText,
|
1203
|
+
};
|
1204
|
+
|
1205
|
+
expect(jsonSchemaService.validateInput(value, schema)).toBe(true);
|
1206
|
+
});
|
1207
|
+
|
1208
|
+
it('should throw if dam-image contains a reserved attribute', () => {
|
1209
|
+
const formattedText: FormattedText = [
|
1210
|
+
{
|
1211
|
+
type: 'dam-image',
|
1212
|
+
damSystemIdentifier: 'dam-identifier',
|
1213
|
+
damObjectId: '12345',
|
1214
|
+
damSystemType: 'bynder',
|
1215
|
+
attributes: {
|
1216
|
+
// src is reserved (resolved from the selected DAM asset)
|
1217
|
+
src: 'https://www.my-matrix.squiz.net/image.png',
|
1218
|
+
} as any,
|
1219
|
+
},
|
1220
|
+
];
|
1221
|
+
const schema = {
|
1222
|
+
type: 'object',
|
1223
|
+
properties: {
|
1224
|
+
myInput: {
|
1225
|
+
type: 'FormattedText',
|
1226
|
+
},
|
1227
|
+
},
|
1228
|
+
};
|
1229
|
+
const value = {
|
1230
|
+
myInput: formattedText,
|
1231
|
+
};
|
1232
|
+
|
1233
|
+
expect(() => jsonSchemaService.validateInput(value, schema)).toThrow(/does not match any given oneof schema/);
|
1234
|
+
});
|
1063
1235
|
});
|
1064
1236
|
|
1065
1237
|
describe('standard inputs', () => {
|
@@ -145,7 +145,24 @@
|
|
145
145
|
"matrixIdentifier": { "type": "string", "minLength": 1 },
|
146
146
|
"matrixDomain": { "type": "string", "minLength": 1 },
|
147
147
|
"matrixAssetId": { "type": "string", "minLength": 1 },
|
148
|
-
"target": { "type": "string", "enum": ["_blank", "_self", "_parent", "_top"] }
|
148
|
+
"target": { "type": "string", "enum": ["_blank", "_self", "_parent", "_top"] },
|
149
|
+
"attributes": {
|
150
|
+
"allOf": [
|
151
|
+
{
|
152
|
+
"type": "object",
|
153
|
+
"properties": {
|
154
|
+
"href": false,
|
155
|
+
"target": false
|
156
|
+
}
|
157
|
+
},
|
158
|
+
{
|
159
|
+
"type": "object",
|
160
|
+
"additionalProperties": {
|
161
|
+
"type": "string"
|
162
|
+
}
|
163
|
+
}
|
164
|
+
]
|
165
|
+
}
|
149
166
|
},
|
150
167
|
"required": ["type", "matrixDomain", "matrixAssetId", "target", "children"]
|
151
168
|
},
|
@@ -159,7 +176,23 @@
|
|
159
176
|
"matrixIdentifier": { "type": "string", "minLength": 1 },
|
160
177
|
"matrixDomain": { "type": "string", "minLength": 1 },
|
161
178
|
"matrixAssetId": { "type": "string", "minLength": 1 },
|
162
|
-
"formattingOptions": { "$ref": "#/definitions/FormattingOptions" }
|
179
|
+
"formattingOptions": { "$ref": "#/definitions/FormattingOptions" },
|
180
|
+
"attributes": {
|
181
|
+
"allOf": [
|
182
|
+
{
|
183
|
+
"type": "object",
|
184
|
+
"properties": {
|
185
|
+
"src": false
|
186
|
+
}
|
187
|
+
},
|
188
|
+
{
|
189
|
+
"type": "object",
|
190
|
+
"additionalProperties": {
|
191
|
+
"type": "string"
|
192
|
+
}
|
193
|
+
}
|
194
|
+
]
|
195
|
+
}
|
163
196
|
},
|
164
197
|
"required": ["type", "matrixDomain", "matrixAssetId"]
|
165
198
|
},
|
@@ -174,7 +207,23 @@
|
|
174
207
|
"damSystemIdentifier": { "type": "string", "minLength": 1 },
|
175
208
|
"damObjectId": { "type": "string", "minLength": 1 },
|
176
209
|
"damAdditional": { "type": "object", "properties": { "variant": { "type": "string", "minLength": 1 } } },
|
177
|
-
"formattingOptions": { "$ref": "#/definitions/FormattingOptions" }
|
210
|
+
"formattingOptions": { "$ref": "#/definitions/FormattingOptions" },
|
211
|
+
"attributes": {
|
212
|
+
"allOf": [
|
213
|
+
{
|
214
|
+
"type": "object",
|
215
|
+
"properties": {
|
216
|
+
"src": false
|
217
|
+
}
|
218
|
+
},
|
219
|
+
{
|
220
|
+
"type": "object",
|
221
|
+
"additionalProperties": {
|
222
|
+
"type": "string"
|
223
|
+
}
|
224
|
+
}
|
225
|
+
]
|
226
|
+
}
|
178
227
|
},
|
179
228
|
"required": ["type", "damSystemType", "damSystemIdentifier", "damObjectId"]
|
180
229
|
}
|
@@ -22,6 +22,13 @@ export interface FormattedTextLinkToMatrixAsset {
|
|
22
22
|
matrixDomain: string;
|
23
23
|
matrixAssetId: string;
|
24
24
|
target: '_blank' | '_self' | '_parent' | '_top';
|
25
|
+
attributes?: {
|
26
|
+
href?: never;
|
27
|
+
target?: never;
|
28
|
+
[k: string]: unknown;
|
29
|
+
} & {
|
30
|
+
[k: string]: string;
|
31
|
+
};
|
25
32
|
}
|
26
33
|
export interface FormattingOptions {
|
27
34
|
alignment?: 'center' | 'left' | 'right' | 'justify';
|
@@ -33,6 +40,12 @@ export interface FormattedTextMatrixImage {
|
|
33
40
|
matrixDomain: string;
|
34
41
|
matrixAssetId: string;
|
35
42
|
formattingOptions?: FormattingOptions;
|
43
|
+
attributes?: {
|
44
|
+
src?: never;
|
45
|
+
[k: string]: unknown;
|
46
|
+
} & {
|
47
|
+
[k: string]: string;
|
48
|
+
};
|
36
49
|
}
|
37
50
|
export interface FormattedTextDamImage {
|
38
51
|
type: 'dam-image';
|
@@ -44,6 +57,12 @@ export interface FormattedTextDamImage {
|
|
44
57
|
[k: string]: unknown;
|
45
58
|
};
|
46
59
|
formattingOptions?: FormattingOptions;
|
60
|
+
attributes?: {
|
61
|
+
src?: never;
|
62
|
+
[k: string]: unknown;
|
63
|
+
} & {
|
64
|
+
[k: string]: string;
|
65
|
+
};
|
47
66
|
}
|
48
67
|
export interface FormattedTextTag {
|
49
68
|
children?: WithChildrenNode;
|
package/src/manifest/v1/JobV1.ts
CHANGED
@@ -45,26 +45,26 @@ export type CoreSchemaMetaSchema2 =
|
|
45
45
|
$comment?: string;
|
46
46
|
title?: string;
|
47
47
|
description?: string;
|
48
|
-
default?:
|
48
|
+
default?: unknown;
|
49
49
|
readOnly?: boolean;
|
50
50
|
writeOnly?: boolean;
|
51
|
-
examples?:
|
51
|
+
examples?: unknown[];
|
52
52
|
multipleOf?: number;
|
53
53
|
maximum?: number;
|
54
54
|
exclusiveMaximum?: number;
|
55
55
|
minimum?: number;
|
56
56
|
exclusiveMinimum?: number;
|
57
57
|
maxLength?: number;
|
58
|
-
minLength?: number
|
58
|
+
minLength?: number;
|
59
59
|
pattern?: string;
|
60
60
|
additionalItems?: CoreSchemaMetaSchema2;
|
61
61
|
items?: CoreSchemaMetaSchema2 | SchemaArray;
|
62
62
|
maxItems?: number;
|
63
|
-
minItems?: number
|
63
|
+
minItems?: number;
|
64
64
|
uniqueItems?: boolean;
|
65
65
|
contains?: CoreSchemaMetaSchema2;
|
66
66
|
maxProperties?: number;
|
67
|
-
minProperties?: number
|
67
|
+
minProperties?: number;
|
68
68
|
required?: StringArray;
|
69
69
|
additionalProperties?: CoreSchemaMetaSchema2;
|
70
70
|
definitions?: {
|
@@ -80,11 +80,11 @@ export type CoreSchemaMetaSchema2 =
|
|
80
80
|
[k: string]: CoreSchemaMetaSchema2 | StringArray;
|
81
81
|
};
|
82
82
|
propertyNames?: CoreSchemaMetaSchema2;
|
83
|
-
const?:
|
83
|
+
const?: unknown;
|
84
84
|
/**
|
85
85
|
* @minItems 1
|
86
86
|
*/
|
87
|
-
enum?:
|
87
|
+
enum?: unknown[];
|
88
88
|
type?:
|
89
89
|
| (
|
90
90
|
| 'array'
|
@@ -291,26 +291,26 @@ export interface CoreSchemaMetaSchema1 {
|
|
291
291
|
$comment?: string;
|
292
292
|
title?: string;
|
293
293
|
description?: string;
|
294
|
-
default?:
|
294
|
+
default?: unknown;
|
295
295
|
readOnly?: boolean;
|
296
296
|
writeOnly?: boolean;
|
297
|
-
examples?:
|
297
|
+
examples?: unknown[];
|
298
298
|
multipleOf?: number;
|
299
299
|
maximum?: number;
|
300
300
|
exclusiveMaximum?: number;
|
301
301
|
minimum?: number;
|
302
302
|
exclusiveMinimum?: number;
|
303
303
|
maxLength?: number;
|
304
|
-
minLength?: number
|
304
|
+
minLength?: number;
|
305
305
|
pattern?: string;
|
306
306
|
additionalItems?: CoreSchemaMetaSchema2;
|
307
307
|
items?: CoreSchemaMetaSchema2 | SchemaArray;
|
308
308
|
maxItems?: number;
|
309
|
-
minItems?: number
|
309
|
+
minItems?: number;
|
310
310
|
uniqueItems?: boolean;
|
311
311
|
contains?: CoreSchemaMetaSchema2;
|
312
312
|
maxProperties?: number;
|
313
|
-
minProperties?: number
|
313
|
+
minProperties?: number;
|
314
314
|
required?: StringArray;
|
315
315
|
additionalProperties?: CoreSchemaMetaSchema2;
|
316
316
|
definitions?: {
|
@@ -326,11 +326,11 @@ export interface CoreSchemaMetaSchema1 {
|
|
326
326
|
[k: string]: CoreSchemaMetaSchema2 | StringArray;
|
327
327
|
};
|
328
328
|
propertyNames?: CoreSchemaMetaSchema2;
|
329
|
-
const?:
|
329
|
+
const?: unknown;
|
330
330
|
/**
|
331
331
|
* @minItems 1
|
332
332
|
*/
|
333
|
-
enum?:
|
333
|
+
enum?: unknown[];
|
334
334
|
type?:
|
335
335
|
| (
|
336
336
|
| 'array'
|