Skip to content

Commit 0bc06ca

Browse files
authored
[INTERNAL] Bump ajv from 6.14.0 to 8.18.0 and ajv-errors from 1.0.1 to 3.0.0 (#860)
JIRA: CPOUI5FOUNDATION-859 PoC resolution in v4: #427 v5 implementation: UI5/cli#1309 ### Performance There's a slight performance degradation after the update. This is an expected behaviour as the code behind the generated validation function has evolved. They have added more comprehensive checks in there and more verbose logging. This is clearly visible in the coverage reports that we have integrated for tha function in our test scenarios. #### Comparisson Command: `time ui5 build` ##### sap.m ###### After info ProjectBuilder Build succeeded in 18 s info ProjectBuilder Executing cleanup tasks... ui5 build 36.37s user 11.09s system 246% cpu 19.237 total ###### Before info ProjectBuilder Build succeeded in 17 s info ProjectBuilder Executing cleanup tasks... ui5 build 35.54s user 10.14s system 247% cpu 18.480 total --- ##### sap.ui.core ###### After info ProjectBuilder Build succeeded in 9.42 s info ProjectBuilder Executing cleanup tasks... ui5 build 23.09s user 5.16s system 276% cpu 10.212 total ###### Before info ProjectBuilder Build succeeded in 9.43 s info ProjectBuilder Executing cleanup tasks... ui5 build 22.54s user 5.43s system 273% cpu 10.242 total
1 parent 731d26b commit 0bc06ca

33 files changed

Lines changed: 959 additions & 781 deletions

lib/validation/ValidationError.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ class ValidationError extends Error {
8080
}
8181

8282
let message = "Configuration ";
83-
if (error.dataPath) {
84-
message += chalk.underline(chalk.red(error.dataPath.substr(1))) + " ";
83+
if (error.instancePath) {
84+
message += chalk.underline(chalk.red(error.instancePath.substr(1))) + " ";
8585
}
8686

8787
switch (error.keyword) {
@@ -107,7 +107,7 @@ class ValidationError extends Error {
107107

108108
static _findDuplicateError(error, errorIndex, errors) {
109109
const foundIndex = errors.findIndex(($) => {
110-
if ($.dataPath !== error.dataPath) {
110+
if ($.instancePath !== error.instancePath) {
111111
return false;
112112
} else if ($.keyword !== error.keyword) {
113113
return false;
@@ -131,13 +131,13 @@ class ValidationError extends Error {
131131
}
132132

133133
static analyzeYamlError({error, yaml}) {
134-
if (error.dataPath === "" && error.keyword === "required") {
134+
if (error.instancePath === "" && error.keyword === "required") {
135135
// There is no line/column for a missing required property on root level
136136
return {line: -1, column: -1};
137137
}
138138

139139
// Skip leading /
140-
const objectPath = error.dataPath.substr(1).split("/");
140+
const objectPath = error.instancePath.substr(1).split("/");
141141

142142
if (error.keyword === "additionalProperties") {
143143
objectPath.push(error.params.additionalProperty);

lib/validation/schema/specVersion/kind/extension.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
}
2222
},
2323
"if": {
24+
"type": "object",
2425
"properties": {
2526
"type": {"const": null}
2627
},
@@ -29,6 +30,7 @@
2930
"then": {},
3031
"else": {
3132
"if": {
33+
"type": "object",
3234
"properties": {
3335
"type": {"const": "task"}
3436
}
@@ -38,6 +40,7 @@
3840
},
3941
"else": {
4042
"if": {
43+
"type": "object",
4144
"properties": {
4245
"type": {"const": "server-middleware"}
4346
}
@@ -47,6 +50,7 @@
4750
},
4851
"else": {
4952
"if": {
53+
"type": "object",
5054
"properties": {
5155
"type": {"const": "project-shim"}
5256
}

lib/validation/schema/specVersion/kind/extension/project-shim.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55
"type": "object",
66
"required": ["specVersion", "kind", "type", "metadata", "shims"],
77
"if": {
8+
"type": "object",
89
"properties": {
910
"specVersion": { "enum": ["3.0", "3.1", "3.2", "4.0"] }
1011
}
1112
},
1213
"then": {
14+
"type": "object",
1315
"additionalProperties": false,
1416
"properties": {
1517
"specVersion": {
@@ -35,11 +37,13 @@
3537
},
3638
"else": {
3739
"if": {
40+
"type": "object",
3841
"properties": {
3942
"specVersion": { "enum": ["2.1", "2.2", "2.3", "2.4", "2.5", "2.6"] }
4043
}
4144
},
4245
"then": {
46+
"type": "object",
4347
"additionalProperties": false,
4448
"properties": {
4549
"specVersion": {

lib/validation/schema/specVersion/kind/extension/server-middleware.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
}
1212
},
1313
"then": {
14+
"type": "object",
1415
"additionalProperties": false,
1516
"properties": {
1617
"specVersion": { "enum": ["3.0", "3.1", "3.2", "4.0"] },
@@ -34,11 +35,13 @@
3435
},
3536
"else": {
3637
"if": {
38+
"type": "object",
3739
"properties": {
3840
"specVersion": { "enum": ["2.1", "2.2", "2.3", "2.4", "2.5", "2.6"] }
3941
}
4042
},
4143
"then": {
44+
"type": "object",
4245
"additionalProperties": false,
4346
"properties": {
4447
"specVersion": { "enum": ["2.1", "2.2", "2.3", "2.4", "2.5", "2.6"] },

lib/validation/schema/specVersion/kind/extension/task.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55
"type": "object",
66
"required": ["specVersion", "kind", "type", "metadata", "task"],
77
"if": {
8+
"type": "object",
89
"properties": {
910
"specVersion": { "enum": ["3.0", "3.1", "3.2", "4.0"] }
1011
}
1112
},
1213
"then": {
14+
"type": "object",
1315
"additionalProperties": false,
1416
"properties": {
1517
"specVersion": { "enum": ["3.0", "3.1", "3.2", "4.0"] },
@@ -33,11 +35,13 @@
3335
},
3436
"else": {
3537
"if": {
38+
"type": "object",
3639
"properties": {
3740
"specVersion": { "enum": ["2.1", "2.2", "2.3", "2.4", "2.5", "2.6"] }
3841
}
3942
},
4043
"then": {
44+
"type": "object",
4145
"additionalProperties": false,
4246
"properties": {
4347
"specVersion": { "enum": ["2.1", "2.2", "2.3", "2.4", "2.5", "2.6"] },

lib/validation/schema/specVersion/kind/project.json

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
}
2121
},
2222
"if": {
23+
"type": "object",
2324
"properties": {
2425
"type": {"const": null}
2526
},
@@ -28,6 +29,7 @@
2829
"then": {},
2930
"else": {
3031
"if": {
32+
"type": "object",
3133
"properties": {
3234
"type": {"const": "application"}
3335
}
@@ -37,6 +39,7 @@
3739
},
3840
"else": {
3941
"if": {
42+
"type": "object",
4043
"properties": {
4144
"type": {"const": "library"}
4245
}
@@ -46,6 +49,7 @@
4649
},
4750
"else": {
4851
"if": {
52+
"type": "object",
4953
"properties": {
5054
"type": {"const": "theme-library"}
5155
}
@@ -55,6 +59,7 @@
5559
},
5660
"else": {
5761
"if": {
62+
"type": "object",
5863
"properties": {
5964
"type": {"const": "module"}
6065
}
@@ -144,7 +149,6 @@
144149
},
145150
"builder-bundles": {
146151
"type": "array",
147-
"additionalProperties": false,
148152
"items": {
149153
"type": "object",
150154
"additionalProperties": false,
@@ -160,7 +164,6 @@
160164
},
161165
"builder-bundles-2.4": {
162166
"type": "array",
163-
"additionalProperties": false,
164167
"items": {
165168
"type": "object",
166169
"additionalProperties": false,
@@ -176,7 +179,6 @@
176179
},
177180
"builder-bundles-3.0": {
178181
"type": "array",
179-
"additionalProperties": false,
180182
"items": {
181183
"type": "object",
182184
"additionalProperties": false,
@@ -192,7 +194,6 @@
192194
},
193195
"builder-bundles-3.2": {
194196
"type": "array",
195-
"additionalProperties": false,
196197
"items": {
197198
"type": "object",
198199
"additionalProperties": false,
@@ -208,7 +209,6 @@
208209
},
209210
"builder-bundles-4.0": {
210211
"type": "array",
211-
"additionalProperties": false,
212212
"items": {
213213
"type": "object",
214214
"additionalProperties": false,
@@ -414,6 +414,7 @@
414414
"type": "array",
415415
"items": {
416416
"if": {
417+
"type": "object",
417418
"properties": {
418419
"mode": {
419420
"const": "require"
@@ -740,24 +741,28 @@
740741
"not": {
741742
"anyOf": [
742743
{
744+
"type": "object",
743745
"properties": {
744746
"optional": {"enum": [false, null]}
745747
}
746748
},
747749
{
750+
"type": "object",
748751
"properties": {
749752
"development": {"enum": [false, null]}
750753
}
751754
},
752755
{
753756
"not": {
757+
"type": "object",
754758
"properties": {
755759
"optional": {"type": "boolean"}
756760
}
757761
}
758762
},
759763
{
760764
"not": {
765+
"type": "object",
761766
"properties": {
762767
"development": {"type": "boolean"}
763768
}
@@ -768,6 +773,7 @@
768773
}
769774
},
770775
"then": {
776+
"type": "object",
771777
"additionalProperties": false,
772778
"properties": {
773779
"name": {

lib/validation/schema/specVersion/kind/project/application.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55
"type": "object",
66
"required": ["specVersion", "type", "metadata"],
77
"if": {
8+
"type": "object",
89
"properties": {
910
"specVersion": { "enum": ["4.0"] }
1011
}
1112
},
1213
"then": {
14+
"type": "object",
1315
"additionalProperties": false,
1416
"properties": {
1517
"specVersion": { "enum": ["4.0"] },
@@ -42,11 +44,13 @@
4244
},
4345
"else": {
4446
"if": {
47+
"type": "object",
4548
"properties": {
4649
"specVersion": { "enum": ["3.2"] }
4750
}
4851
},
4952
"then": {
53+
"type": "object",
5054
"additionalProperties": false,
5155
"properties": {
5256
"specVersion": { "enum": ["3.2"] },
@@ -80,11 +84,13 @@
8084
"else": {
8185

8286
"if": {
87+
"type": "object",
8388
"properties": {
8489
"specVersion": { "enum": ["3.0", "3.1"] }
8590
}
8691
},
8792
"then": {
93+
"type": "object",
8894
"additionalProperties": false,
8995
"properties": {
9096
"specVersion": { "enum": ["3.0", "3.1"] },
@@ -117,11 +123,13 @@
117123
},
118124
"else": {
119125
"if": {
126+
"type": "object",
120127
"properties": {
121128
"specVersion": { "enum": ["2.6"] }
122129
}
123130
},
124131
"then": {
132+
"type": "object",
125133
"additionalProperties": false,
126134
"properties": {
127135
"specVersion": { "enum": ["2.6"] },
@@ -154,11 +162,13 @@
154162
},
155163
"else": {
156164
"if": {
165+
"type": "object",
157166
"properties": {
158167
"specVersion": { "enum": ["2.5"] }
159168
}
160169
},
161170
"then": {
171+
"type": "object",
162172
"additionalProperties": false,
163173
"properties": {
164174
"specVersion": { "enum": ["2.5"] },
@@ -191,11 +201,13 @@
191201
},
192202
"else": {
193203
"if": {
204+
"type": "object",
194205
"properties": {
195206
"specVersion": { "enum": ["2.4"] }
196207
}
197208
},
198209
"then": {
210+
"type": "object",
199211
"additionalProperties": false,
200212
"properties": {
201213
"specVersion": { "enum": ["2.4"] },
@@ -228,11 +240,13 @@
228240
},
229241
"else": {
230242
"if": {
243+
"type": "object",
231244
"properties": {
232245
"specVersion": { "enum": ["2.3"] }
233246
}
234247
},
235248
"then": {
249+
"type": "object",
236250
"additionalProperties": false,
237251
"properties": {
238252
"specVersion": { "enum": ["2.3"] },
@@ -265,11 +279,13 @@
265279
},
266280
"else": {
267281
"if": {
282+
"type": "object",
268283
"properties": {
269284
"specVersion": { "enum": ["2.1", "2.2"] }
270285
}
271286
},
272287
"then": {
288+
"type": "object",
273289
"additionalProperties": false,
274290
"properties": {
275291
"specVersion": { "enum": ["2.1", "2.2"] },

0 commit comments

Comments
 (0)