@microsoft/sp-module-interfaces 1.22.0-beta.3 → 1.22.0-beta.4
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/lib-commonjs/manifestSchemaValidator.js +25 -53
- package/lib-commonjs/manifestSchemas/jsonSchemas/adaptive-card-extension-manifest.schema.json +4 -1
- package/lib-commonjs/manifestSchemas/jsonSchemas/client-side-application-manifest.schema.json +9 -4
- package/lib-commonjs/manifestSchemas/jsonSchemas/client-side-assembly-manifest.schema.json +4 -1
- package/lib-commonjs/manifestSchemas/jsonSchemas/client-side-component-loader-configuration.schema.json +6 -3
- package/lib-commonjs/manifestSchemas/jsonSchemas/client-side-extension-manifest.schema.json +4 -1
- package/lib-commonjs/manifestSchemas/jsonSchemas/client-side-library-manifest.schema.json +4 -1
- package/lib-commonjs/manifestSchemas/jsonSchemas/client-side-web-part-manifest.schema.json +6 -2
- package/lib-commonjs/manifestSchemas/jsonSchemas/command-set-extension-manifest.schema.json +5 -1
- package/lib-commonjs/manifestSchemas/jsonSchemas/guid.schema.json +1 -0
- package/lib-commonjs/manifestSchemas/jsonSchemas/prefab-app-manifest.schema.json +8 -3
- package/lib-dts/manifestSchemaValidator.d.ts +4 -5
- package/lib-esm/manifestSchemaValidator.js +27 -47
- package/lib-esm/manifestSchemas/jsonSchemas/adaptive-card-extension-manifest.schema.json +4 -1
- package/lib-esm/manifestSchemas/jsonSchemas/client-side-application-manifest.schema.json +9 -4
- package/lib-esm/manifestSchemas/jsonSchemas/client-side-assembly-manifest.schema.json +4 -1
- package/lib-esm/manifestSchemas/jsonSchemas/client-side-component-loader-configuration.schema.json +6 -3
- package/lib-esm/manifestSchemas/jsonSchemas/client-side-extension-manifest.schema.json +4 -1
- package/lib-esm/manifestSchemas/jsonSchemas/client-side-library-manifest.schema.json +4 -1
- package/lib-esm/manifestSchemas/jsonSchemas/client-side-web-part-manifest.schema.json +6 -2
- package/lib-esm/manifestSchemas/jsonSchemas/command-set-extension-manifest.schema.json +5 -1
- package/lib-esm/manifestSchemas/jsonSchemas/guid.schema.json +1 -0
- package/lib-esm/manifestSchemas/jsonSchemas/prefab-app-manifest.schema.json +8 -3
- package/package.json +4 -4
|
@@ -2,21 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
get: all[name]
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
default: function() {
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
13
8
|
return ManifestValidator;
|
|
14
|
-
},
|
|
15
|
-
zSchemaOptions: function() {
|
|
16
|
-
return zSchemaOptions;
|
|
17
9
|
}
|
|
18
10
|
});
|
|
19
|
-
const
|
|
11
|
+
const _ajv = /*#__PURE__*/ _interop_require_default(require("ajv"));
|
|
20
12
|
const _nodecorelibrary = require("@rushstack/node-core-library");
|
|
21
13
|
const _clientsidecomponentmanifestschemajson = /*#__PURE__*/ _interop_require_default(require("./manifestSchemas/jsonSchemas/client-side-component-manifest.schema.json"));
|
|
22
14
|
const _clientsideapplicationmanifestschemajson = /*#__PURE__*/ _interop_require_default(require("./manifestSchemas/jsonSchemas/client-side-application-manifest.schema.json"));
|
|
@@ -28,7 +20,6 @@ const _clientsidelibrarymanifestschemajson = /*#__PURE__*/ _interop_require_defa
|
|
|
28
20
|
const _clientsideassemblymanifestschemajson = /*#__PURE__*/ _interop_require_default(require("./manifestSchemas/jsonSchemas/client-side-assembly-manifest.schema.json"));
|
|
29
21
|
const _clientsidemultiversionmanifestschemajson = /*#__PURE__*/ _interop_require_default(require("./manifestSchemas/jsonSchemas/client-side-multi-version-manifest.schema.json"));
|
|
30
22
|
const _sitedesignscriptactionsschemajson = /*#__PURE__*/ _interop_require_default(require("./manifestSchemas/remote/site-design-script-actions.schema.json"));
|
|
31
|
-
const _draft04schemajson = /*#__PURE__*/ _interop_require_default(require("./manifestSchemas/remote/draft-04.schema.json"));
|
|
32
23
|
function _interop_require_default(obj) {
|
|
33
24
|
return obj && obj.__esModule ? obj : {
|
|
34
25
|
default: obj
|
|
@@ -39,7 +30,6 @@ const schemasDirectory = `${__dirname}/manifestSchemas/jsonSchemas`;
|
|
|
39
30
|
const schemaFiles = _nodecorelibrary.FileSystem.readFolderItemNames(schemasDirectory);
|
|
40
31
|
const schemas = schemaFiles.map((schemaFile)=>require(`${schemasDirectory}/${schemaFile}`));
|
|
41
32
|
const SITE_SCRIPTS_SCHEMA_URL = 'https://developer.microsoft.com/json-schemas/sp/site-design-script-actions.schema.json';
|
|
42
|
-
const DRAFT_07_SCHEMA_URL = 'http://json-schema.org/draft-07/schema#';
|
|
43
33
|
const siteScriptsSchemaPromise = fetch(SITE_SCRIPTS_SCHEMA_URL).then((response)=>{
|
|
44
34
|
return response.text();
|
|
45
35
|
}).catch((error)=>{
|
|
@@ -48,36 +38,14 @@ const siteScriptsSchemaPromise = fetch(SITE_SCRIPTS_SCHEMA_URL).then((response)=
|
|
|
48
38
|
// fallback to local copy
|
|
49
39
|
return JSON.stringify(_sitedesignscriptactionsschemajson.default);
|
|
50
40
|
});
|
|
51
|
-
const
|
|
52
|
-
breakOnFirstError: true,
|
|
53
|
-
forceAdditional: true,
|
|
54
|
-
forceItems: true,
|
|
55
|
-
forceMaxLength: false,
|
|
56
|
-
forceProperties: false,
|
|
57
|
-
noExtraKeywords: true,
|
|
58
|
-
noTypeless: true,
|
|
59
|
-
noEmptyStrings: true
|
|
60
|
-
};
|
|
61
|
-
const schemaValidator = new _zschema.default(zSchemaOptions);
|
|
62
|
-
const draft07ValidationOptions = {
|
|
63
|
-
strictMode: false,
|
|
64
|
-
ignoreUnresolvableReferences: true,
|
|
65
|
-
ignoreUnknownFormats: true
|
|
66
|
-
};
|
|
67
|
-
//
|
|
68
|
-
// this one is needed for the site scripts reference.
|
|
69
|
-
// We're faking draft-07 schema with draft-04 schema as z-schema doesn't support draft-07
|
|
70
|
-
//
|
|
71
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
72
|
-
schemaValidator.setRemoteReference(DRAFT_07_SCHEMA_URL, _draft04schemajson.default, draft07ValidationOptions);
|
|
41
|
+
const schemaValidator = new _ajv.default();
|
|
73
42
|
siteScriptsSchemaPromise.then((remoteSchema)=>{
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
43
|
+
schemaValidator.addSchema(JSON.parse(remoteSchema), SITE_SCRIPTS_SCHEMA_URL);
|
|
44
|
+
schemas.forEach((schema, index)=>{
|
|
45
|
+
// Use the schema's id property as the key to avoid "schema id ignored" warnings
|
|
46
|
+
const schemaId = schema.id || `schema-${index}`;
|
|
47
|
+
schemaValidator.addSchema(schema, schemaId);
|
|
79
48
|
});
|
|
80
|
-
schemaValidator.validateSchema(schemas);
|
|
81
49
|
}).catch((error)=>{
|
|
82
50
|
// swallowing the error here
|
|
83
51
|
});
|
|
@@ -119,18 +87,18 @@ class ManifestValidator {
|
|
|
119
87
|
return ManifestValidator._validateManifest(manifest, _clientsidecomponentmanifestschemajson.default);
|
|
120
88
|
}
|
|
121
89
|
static extractInnerErrorMessages(errors) {
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
90
|
+
const printAjvError = (error)=>{
|
|
91
|
+
// AJV errors don't have nested inner errors
|
|
92
|
+
// Each error is flat and represents a single validation failure
|
|
93
|
+
const path = error.dataPath || error.schemaPath || 'root';
|
|
94
|
+
const message = error.message || 'Validation error';
|
|
127
95
|
return [
|
|
128
|
-
`(${
|
|
129
|
-
]
|
|
96
|
+
`(${path}) ${message}`
|
|
97
|
+
];
|
|
130
98
|
};
|
|
131
99
|
let errorList = [];
|
|
132
100
|
errors.map((error)=>{
|
|
133
|
-
errorList = errorList.concat(
|
|
101
|
+
errorList = errorList.concat(printAjvError(error));
|
|
134
102
|
});
|
|
135
103
|
return errorList;
|
|
136
104
|
}
|
|
@@ -145,10 +113,14 @@ class ManifestValidator {
|
|
|
145
113
|
if (typeof manifest === 'string') {
|
|
146
114
|
manifest = JSON.parse(manifest);
|
|
147
115
|
}
|
|
148
|
-
const
|
|
116
|
+
const validationResult = schemaValidator.validate(schema, manifest);
|
|
117
|
+
// Handle the case where validate returns a Promise (async validation)
|
|
118
|
+
if (typeof validationResult === 'object' && validationResult && 'then' in validationResult) {
|
|
119
|
+
throw new Error('Async validation detected. Ensure all schemas are pre-compiled and synchronous.');
|
|
120
|
+
}
|
|
149
121
|
return {
|
|
150
|
-
result:
|
|
151
|
-
errors: schemaValidator.
|
|
122
|
+
result: validationResult,
|
|
123
|
+
errors: schemaValidator.errors || []
|
|
152
124
|
};
|
|
153
125
|
}
|
|
154
126
|
}
|
package/lib-commonjs/manifestSchemas/jsonSchemas/client-side-application-manifest.schema.json
CHANGED
|
@@ -9,7 +9,10 @@
|
|
|
9
9
|
"type": "object",
|
|
10
10
|
|
|
11
11
|
"properties": {
|
|
12
|
-
"$schema": {
|
|
12
|
+
"$schema": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"minLength": 1
|
|
15
|
+
},
|
|
13
16
|
|
|
14
17
|
"manifestVersion": { "$ref": "any-value.schema.json" },
|
|
15
18
|
"id": { "$ref": "any-value.schema.json" },
|
|
@@ -83,13 +86,15 @@
|
|
|
83
86
|
"preloadListItemQueryOption": {
|
|
84
87
|
"title": "Preload List Item Query Options",
|
|
85
88
|
"description": "This specifies an optional OData query expression with the syntax that would be used in the URL query parameter for a REST API call that fetches a SharePoint list item.",
|
|
86
|
-
"type": "string"
|
|
89
|
+
"type": "string",
|
|
90
|
+
"minLength": 1
|
|
87
91
|
},
|
|
88
92
|
|
|
89
93
|
"preloadListItemQueryOptionOverride": {
|
|
90
94
|
"title": "Preload List Item Query Options (flighted)",
|
|
91
95
|
"description": "This specifies an optional OData query expression with the syntax that would be used in the URL query parameter for a REST API call that fetches a SharePoint list item.",
|
|
92
|
-
"type": "string"
|
|
96
|
+
"type": "string",
|
|
97
|
+
"minLength": 1
|
|
93
98
|
},
|
|
94
99
|
|
|
95
100
|
"preloadListItemProperties": {
|
|
@@ -100,7 +105,7 @@
|
|
|
100
105
|
"minItems": 0,
|
|
101
106
|
"items": {
|
|
102
107
|
"type": "string",
|
|
103
|
-
"minLength":
|
|
108
|
+
"minLength": 1
|
|
104
109
|
}
|
|
105
110
|
}
|
|
106
111
|
},
|
|
@@ -37,17 +37,20 @@
|
|
|
37
37
|
"path": {
|
|
38
38
|
"type": "string",
|
|
39
39
|
"title": "Path",
|
|
40
|
-
"description": "The path to the resource."
|
|
40
|
+
"description": "The path to the resource.",
|
|
41
|
+
"minLength": 1
|
|
41
42
|
},
|
|
42
43
|
"integrity": {
|
|
43
44
|
"type": "string",
|
|
44
45
|
"title": "Integrity",
|
|
45
|
-
"description": "The subresource integrity hash of the resource referenced in \"path\"."
|
|
46
|
+
"description": "The subresource integrity hash of the resource referenced in \"path\".",
|
|
47
|
+
"minLength": 1
|
|
46
48
|
}
|
|
47
49
|
}
|
|
48
50
|
},
|
|
49
51
|
{
|
|
50
|
-
"type": "string"
|
|
52
|
+
"type": "string",
|
|
53
|
+
"minLength": 1
|
|
51
54
|
}
|
|
52
55
|
]
|
|
53
56
|
}
|
|
@@ -66,7 +66,10 @@
|
|
|
66
66
|
{
|
|
67
67
|
"type": "object",
|
|
68
68
|
"properties": {
|
|
69
|
-
"$schema": {
|
|
69
|
+
"$schema": {
|
|
70
|
+
"type": "string",
|
|
71
|
+
"minLength": 1
|
|
72
|
+
},
|
|
70
73
|
|
|
71
74
|
"manifestVersion": { "$ref": "any-value.schema.json" },
|
|
72
75
|
"id": { "$ref": "any-value.schema.json" },
|
|
@@ -183,7 +186,8 @@
|
|
|
183
186
|
"enum": ["high", "low"]
|
|
184
187
|
},
|
|
185
188
|
"componentId": {
|
|
186
|
-
"type": "string"
|
|
189
|
+
"type": "string",
|
|
190
|
+
"minLength": 1
|
|
187
191
|
}
|
|
188
192
|
},
|
|
189
193
|
"required": ["priority", "componentId"]
|
|
@@ -8,7 +8,10 @@
|
|
|
8
8
|
{
|
|
9
9
|
"type": "object",
|
|
10
10
|
"properties": {
|
|
11
|
-
"$schema": {
|
|
11
|
+
"$schema": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"minLength": 1
|
|
14
|
+
},
|
|
12
15
|
|
|
13
16
|
"manifestVersion": { "$ref": "any-value.schema.json" },
|
|
14
17
|
"id": { "$ref": "any-value.schema.json" },
|
|
@@ -66,6 +69,7 @@
|
|
|
66
69
|
},
|
|
67
70
|
"iconImageUrl": {
|
|
68
71
|
"type": "string",
|
|
72
|
+
"minLength": 1,
|
|
69
73
|
"title": "Icon Image URL",
|
|
70
74
|
"description": "An optional URL for an image to be displayed next to the item. The requirements for this image are defined by the type of extension; some extension types may not display the image at all."
|
|
71
75
|
}
|
|
@@ -34,7 +34,10 @@
|
|
|
34
34
|
"type": "object",
|
|
35
35
|
|
|
36
36
|
"properties": {
|
|
37
|
-
"$schema": {
|
|
37
|
+
"$schema": {
|
|
38
|
+
"type": "string",
|
|
39
|
+
"minLength": 1
|
|
40
|
+
},
|
|
38
41
|
|
|
39
42
|
"manifestVersion": { "$ref": "any-value.schema.json" },
|
|
40
43
|
"id": { "$ref": "any-value.schema.json" },
|
|
@@ -102,7 +105,8 @@
|
|
|
102
105
|
"viewId": {
|
|
103
106
|
"title": "Route ID",
|
|
104
107
|
"description": "The unique identifier of the route to be rendered when the settings link is selected.",
|
|
105
|
-
"type": "string"
|
|
108
|
+
"type": "string",
|
|
109
|
+
"minLength": 1
|
|
106
110
|
},
|
|
107
111
|
"text": {
|
|
108
112
|
"title": "Text",
|
|
@@ -127,7 +131,8 @@
|
|
|
127
131
|
"viewId": {
|
|
128
132
|
"title": "Route ID",
|
|
129
133
|
"description": "The unique identifier of the route to be rendered if the entry is added to the page.",
|
|
130
|
-
"type": "string"
|
|
134
|
+
"type": "string",
|
|
135
|
+
"minLength": 1
|
|
131
136
|
},
|
|
132
137
|
"title": {
|
|
133
138
|
"title": "Title",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Ajv from 'ajv';
|
|
2
2
|
import type { IClientSideApplicationManifest } from './manifestSchemas/IClientSideApplicationManifest';
|
|
3
3
|
import type { IClientSideAssemblyManifest } from './manifestSchemas/IClientSideAssemblyManifest';
|
|
4
4
|
import type { IClientSideComponentManifest } from './manifestSchemas/IClientSideComponentManifest';
|
|
@@ -8,10 +8,9 @@ import type { IClientSideMultiVersionManifest } from './manifestSchemas/IClientS
|
|
|
8
8
|
import type { IClientSideWebPartManifest } from './manifestSchemas/IClientSideWebPartManifest';
|
|
9
9
|
import type { ICommandSetExtensionManifest } from './manifestSchemas/ICommandSetExtensionManifest';
|
|
10
10
|
import type { IPrefabAppManifest } from './manifestSchemas/IPrefabAppManifest';
|
|
11
|
-
export declare const zSchemaOptions: ZSchema.Options;
|
|
12
11
|
export interface IManifestValidatorResult {
|
|
13
12
|
result: boolean;
|
|
14
|
-
errors:
|
|
13
|
+
errors: Ajv.ErrorObject[];
|
|
15
14
|
}
|
|
16
15
|
export default class ManifestValidator {
|
|
17
16
|
static registerRemoteSchemaReferences(): Promise<void>;
|
|
@@ -24,8 +23,8 @@ export default class ManifestValidator {
|
|
|
24
23
|
static validateAssemblyManifest(manifest: string | IClientSideAssemblyManifest): IManifestValidatorResult;
|
|
25
24
|
static validateMultiVersionManifest(manifest: string | IClientSideMultiVersionManifest<any>): IManifestValidatorResult;
|
|
26
25
|
static validateManifest(manifest: string | IClientSideComponentManifest): IManifestValidatorResult;
|
|
27
|
-
static extractInnerErrorMessages(errors:
|
|
28
|
-
static getFormattedErrorMessage(errors:
|
|
26
|
+
static extractInnerErrorMessages(errors: Ajv.ErrorObject[]): string[];
|
|
27
|
+
static getFormattedErrorMessage(errors: Ajv.ErrorObject[]): string;
|
|
29
28
|
private static _validateManifest;
|
|
30
29
|
}
|
|
31
30
|
//# sourceMappingURL=manifestSchemaValidator.d.ts.map
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Ajv from 'ajv';
|
|
2
2
|
import { FileSystem } from '@rushstack/node-core-library';
|
|
3
|
-
// Discover the schema files
|
|
4
|
-
const schemasDirectory = `${__dirname}/manifestSchemas/jsonSchemas`;
|
|
5
|
-
const schemaFiles = FileSystem.readFolderItemNames(schemasDirectory);
|
|
6
|
-
const schemas = schemaFiles.map((schemaFile)=>require(`${schemasDirectory}/${schemaFile}`));
|
|
7
3
|
import manifestSchema from './manifestSchemas/jsonSchemas/client-side-component-manifest.schema.json';
|
|
8
4
|
import applicationSchema from './manifestSchemas/jsonSchemas/client-side-application-manifest.schema.json';
|
|
9
5
|
import prefabAppSchema from './manifestSchemas/jsonSchemas/prefab-app-manifest.schema.json';
|
|
@@ -13,11 +9,13 @@ import extensionSchema from './manifestSchemas/jsonSchemas/client-side-extension
|
|
|
13
9
|
import librarySchema from './manifestSchemas/jsonSchemas/client-side-library-manifest.schema.json';
|
|
14
10
|
import assemblySchema from './manifestSchemas/jsonSchemas/client-side-assembly-manifest.schema.json';
|
|
15
11
|
import multiVersionSchema from './manifestSchemas/jsonSchemas/client-side-multi-version-manifest.schema.json';
|
|
16
|
-
// local copy of site scripts schema
|
|
12
|
+
// local copy of site scripts schema
|
|
17
13
|
import siteScriptsSchema from './manifestSchemas/remote/site-design-script-actions.schema.json';
|
|
18
|
-
|
|
14
|
+
// Discover the schema files
|
|
15
|
+
const schemasDirectory = `${__dirname}/manifestSchemas/jsonSchemas`;
|
|
16
|
+
const schemaFiles = FileSystem.readFolderItemNames(schemasDirectory);
|
|
17
|
+
const schemas = schemaFiles.map((schemaFile)=>require(`${schemasDirectory}/${schemaFile}`));
|
|
19
18
|
const SITE_SCRIPTS_SCHEMA_URL = 'https://developer.microsoft.com/json-schemas/sp/site-design-script-actions.schema.json';
|
|
20
|
-
const DRAFT_07_SCHEMA_URL = 'http://json-schema.org/draft-07/schema#';
|
|
21
19
|
const siteScriptsSchemaPromise = fetch(SITE_SCRIPTS_SCHEMA_URL).then((response)=>{
|
|
22
20
|
return response.text();
|
|
23
21
|
}).catch((error)=>{
|
|
@@ -26,36 +24,14 @@ const siteScriptsSchemaPromise = fetch(SITE_SCRIPTS_SCHEMA_URL).then((response)=
|
|
|
26
24
|
// fallback to local copy
|
|
27
25
|
return JSON.stringify(siteScriptsSchema);
|
|
28
26
|
});
|
|
29
|
-
|
|
30
|
-
breakOnFirstError: true,
|
|
31
|
-
forceAdditional: true,
|
|
32
|
-
forceItems: true,
|
|
33
|
-
forceMaxLength: false,
|
|
34
|
-
forceProperties: false,
|
|
35
|
-
noExtraKeywords: true,
|
|
36
|
-
noTypeless: true,
|
|
37
|
-
noEmptyStrings: true
|
|
38
|
-
};
|
|
39
|
-
const schemaValidator = new ZSchema(zSchemaOptions);
|
|
40
|
-
const draft07ValidationOptions = {
|
|
41
|
-
strictMode: false,
|
|
42
|
-
ignoreUnresolvableReferences: true,
|
|
43
|
-
ignoreUnknownFormats: true
|
|
44
|
-
};
|
|
45
|
-
//
|
|
46
|
-
// this one is needed for the site scripts reference.
|
|
47
|
-
// We're faking draft-07 schema with draft-04 schema as z-schema doesn't support draft-07
|
|
48
|
-
//
|
|
49
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
50
|
-
schemaValidator.setRemoteReference(DRAFT_07_SCHEMA_URL, draft04Schema, draft07ValidationOptions);
|
|
27
|
+
const schemaValidator = new Ajv();
|
|
51
28
|
siteScriptsSchemaPromise.then((remoteSchema)=>{
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
29
|
+
schemaValidator.addSchema(JSON.parse(remoteSchema), SITE_SCRIPTS_SCHEMA_URL);
|
|
30
|
+
schemas.forEach((schema, index)=>{
|
|
31
|
+
// Use the schema's id property as the key to avoid "schema id ignored" warnings
|
|
32
|
+
const schemaId = schema.id || `schema-${index}`;
|
|
33
|
+
schemaValidator.addSchema(schema, schemaId);
|
|
57
34
|
});
|
|
58
|
-
schemaValidator.validateSchema(schemas);
|
|
59
35
|
}).catch((error)=>{
|
|
60
36
|
// swallowing the error here
|
|
61
37
|
});
|
|
@@ -97,18 +73,18 @@ class ManifestValidator {
|
|
|
97
73
|
return ManifestValidator._validateManifest(manifest, manifestSchema);
|
|
98
74
|
}
|
|
99
75
|
static extractInnerErrorMessages(errors) {
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
76
|
+
const printAjvError = (error)=>{
|
|
77
|
+
// AJV errors don't have nested inner errors
|
|
78
|
+
// Each error is flat and represents a single validation failure
|
|
79
|
+
const path = error.dataPath || error.schemaPath || 'root';
|
|
80
|
+
const message = error.message || 'Validation error';
|
|
105
81
|
return [
|
|
106
|
-
`(${
|
|
107
|
-
]
|
|
82
|
+
`(${path}) ${message}`
|
|
83
|
+
];
|
|
108
84
|
};
|
|
109
85
|
let errorList = [];
|
|
110
86
|
errors.map((error)=>{
|
|
111
|
-
errorList = errorList.concat(
|
|
87
|
+
errorList = errorList.concat(printAjvError(error));
|
|
112
88
|
});
|
|
113
89
|
return errorList;
|
|
114
90
|
}
|
|
@@ -123,10 +99,14 @@ class ManifestValidator {
|
|
|
123
99
|
if (typeof manifest === 'string') {
|
|
124
100
|
manifest = JSON.parse(manifest);
|
|
125
101
|
}
|
|
126
|
-
const
|
|
102
|
+
const validationResult = schemaValidator.validate(schema, manifest);
|
|
103
|
+
// Handle the case where validate returns a Promise (async validation)
|
|
104
|
+
if (typeof validationResult === 'object' && validationResult && 'then' in validationResult) {
|
|
105
|
+
throw new Error('Async validation detected. Ensure all schemas are pre-compiled and synchronous.');
|
|
106
|
+
}
|
|
127
107
|
return {
|
|
128
|
-
result:
|
|
129
|
-
errors: schemaValidator.
|
|
108
|
+
result: validationResult,
|
|
109
|
+
errors: schemaValidator.errors || []
|
|
130
110
|
};
|
|
131
111
|
}
|
|
132
112
|
}
|
|
@@ -9,7 +9,10 @@
|
|
|
9
9
|
"type": "object",
|
|
10
10
|
|
|
11
11
|
"properties": {
|
|
12
|
-
"$schema": {
|
|
12
|
+
"$schema": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"minLength": 1
|
|
15
|
+
},
|
|
13
16
|
|
|
14
17
|
"manifestVersion": { "$ref": "any-value.schema.json" },
|
|
15
18
|
"id": { "$ref": "any-value.schema.json" },
|
|
@@ -83,13 +86,15 @@
|
|
|
83
86
|
"preloadListItemQueryOption": {
|
|
84
87
|
"title": "Preload List Item Query Options",
|
|
85
88
|
"description": "This specifies an optional OData query expression with the syntax that would be used in the URL query parameter for a REST API call that fetches a SharePoint list item.",
|
|
86
|
-
"type": "string"
|
|
89
|
+
"type": "string",
|
|
90
|
+
"minLength": 1
|
|
87
91
|
},
|
|
88
92
|
|
|
89
93
|
"preloadListItemQueryOptionOverride": {
|
|
90
94
|
"title": "Preload List Item Query Options (flighted)",
|
|
91
95
|
"description": "This specifies an optional OData query expression with the syntax that would be used in the URL query parameter for a REST API call that fetches a SharePoint list item.",
|
|
92
|
-
"type": "string"
|
|
96
|
+
"type": "string",
|
|
97
|
+
"minLength": 1
|
|
93
98
|
},
|
|
94
99
|
|
|
95
100
|
"preloadListItemProperties": {
|
|
@@ -100,7 +105,7 @@
|
|
|
100
105
|
"minItems": 0,
|
|
101
106
|
"items": {
|
|
102
107
|
"type": "string",
|
|
103
|
-
"minLength":
|
|
108
|
+
"minLength": 1
|
|
104
109
|
}
|
|
105
110
|
}
|
|
106
111
|
},
|
package/lib-esm/manifestSchemas/jsonSchemas/client-side-component-loader-configuration.schema.json
CHANGED
|
@@ -37,17 +37,20 @@
|
|
|
37
37
|
"path": {
|
|
38
38
|
"type": "string",
|
|
39
39
|
"title": "Path",
|
|
40
|
-
"description": "The path to the resource."
|
|
40
|
+
"description": "The path to the resource.",
|
|
41
|
+
"minLength": 1
|
|
41
42
|
},
|
|
42
43
|
"integrity": {
|
|
43
44
|
"type": "string",
|
|
44
45
|
"title": "Integrity",
|
|
45
|
-
"description": "The subresource integrity hash of the resource referenced in \"path\"."
|
|
46
|
+
"description": "The subresource integrity hash of the resource referenced in \"path\".",
|
|
47
|
+
"minLength": 1
|
|
46
48
|
}
|
|
47
49
|
}
|
|
48
50
|
},
|
|
49
51
|
{
|
|
50
|
-
"type": "string"
|
|
52
|
+
"type": "string",
|
|
53
|
+
"minLength": 1
|
|
51
54
|
}
|
|
52
55
|
]
|
|
53
56
|
}
|
|
@@ -66,7 +66,10 @@
|
|
|
66
66
|
{
|
|
67
67
|
"type": "object",
|
|
68
68
|
"properties": {
|
|
69
|
-
"$schema": {
|
|
69
|
+
"$schema": {
|
|
70
|
+
"type": "string",
|
|
71
|
+
"minLength": 1
|
|
72
|
+
},
|
|
70
73
|
|
|
71
74
|
"manifestVersion": { "$ref": "any-value.schema.json" },
|
|
72
75
|
"id": { "$ref": "any-value.schema.json" },
|
|
@@ -183,7 +186,8 @@
|
|
|
183
186
|
"enum": ["high", "low"]
|
|
184
187
|
},
|
|
185
188
|
"componentId": {
|
|
186
|
-
"type": "string"
|
|
189
|
+
"type": "string",
|
|
190
|
+
"minLength": 1
|
|
187
191
|
}
|
|
188
192
|
},
|
|
189
193
|
"required": ["priority", "componentId"]
|
|
@@ -8,7 +8,10 @@
|
|
|
8
8
|
{
|
|
9
9
|
"type": "object",
|
|
10
10
|
"properties": {
|
|
11
|
-
"$schema": {
|
|
11
|
+
"$schema": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"minLength": 1
|
|
14
|
+
},
|
|
12
15
|
|
|
13
16
|
"manifestVersion": { "$ref": "any-value.schema.json" },
|
|
14
17
|
"id": { "$ref": "any-value.schema.json" },
|
|
@@ -66,6 +69,7 @@
|
|
|
66
69
|
},
|
|
67
70
|
"iconImageUrl": {
|
|
68
71
|
"type": "string",
|
|
72
|
+
"minLength": 1,
|
|
69
73
|
"title": "Icon Image URL",
|
|
70
74
|
"description": "An optional URL for an image to be displayed next to the item. The requirements for this image are defined by the type of extension; some extension types may not display the image at all."
|
|
71
75
|
}
|
|
@@ -34,7 +34,10 @@
|
|
|
34
34
|
"type": "object",
|
|
35
35
|
|
|
36
36
|
"properties": {
|
|
37
|
-
"$schema": {
|
|
37
|
+
"$schema": {
|
|
38
|
+
"type": "string",
|
|
39
|
+
"minLength": 1
|
|
40
|
+
},
|
|
38
41
|
|
|
39
42
|
"manifestVersion": { "$ref": "any-value.schema.json" },
|
|
40
43
|
"id": { "$ref": "any-value.schema.json" },
|
|
@@ -102,7 +105,8 @@
|
|
|
102
105
|
"viewId": {
|
|
103
106
|
"title": "Route ID",
|
|
104
107
|
"description": "The unique identifier of the route to be rendered when the settings link is selected.",
|
|
105
|
-
"type": "string"
|
|
108
|
+
"type": "string",
|
|
109
|
+
"minLength": 1
|
|
106
110
|
},
|
|
107
111
|
"text": {
|
|
108
112
|
"title": "Text",
|
|
@@ -127,7 +131,8 @@
|
|
|
127
131
|
"viewId": {
|
|
128
132
|
"title": "Route ID",
|
|
129
133
|
"description": "The unique identifier of the route to be rendered if the entry is added to the page.",
|
|
130
|
-
"type": "string"
|
|
134
|
+
"type": "string",
|
|
135
|
+
"minLength": 1
|
|
131
136
|
},
|
|
132
137
|
"title": {
|
|
133
138
|
"title": "Title",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/sp-module-interfaces",
|
|
3
|
-
"version": "1.22.0-beta.
|
|
3
|
+
"version": "1.22.0-beta.4",
|
|
4
4
|
"description": "SharePoint Framework module interfaces",
|
|
5
5
|
"license": "https://aka.ms/spfx/license",
|
|
6
6
|
"homepage": "http://aka.ms/spfx",
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"tsdocFlavor": "AEDoc"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@rushstack/node-core-library": "5.
|
|
38
|
-
"
|
|
37
|
+
"@rushstack/node-core-library": "5.17.0",
|
|
38
|
+
"ajv": "^6.12.5"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@rushstack/heft": "
|
|
41
|
+
"@rushstack/heft": "1.1.1",
|
|
42
42
|
"eslint": "8.57.1",
|
|
43
43
|
"@msinternal/internal-no-asset-postprocess-node-rig": "0.1.0"
|
|
44
44
|
},
|