Merge pull request #10244 from backstage/dependabot/npm_and_yarn/ajv-8.10.0
build(deps): bump ajv from 7.0.3 to 8.10.0
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
---
|
||||
'@backstage/catalog-model': patch
|
||||
'@backstage/config-loader': patch
|
||||
'@backstage/plugin-tech-insights-backend-module-jsonfc': patch
|
||||
---
|
||||
|
||||
build(deps): bump `ajv` from 7.0.3 to 8.10.0
|
||||
@@ -37,7 +37,7 @@
|
||||
"@backstage/config": "^1.0.0",
|
||||
"@backstage/errors": "^1.0.0",
|
||||
"@backstage/types": "^1.0.0",
|
||||
"ajv": "^7.0.3",
|
||||
"ajv": "^8.10.0",
|
||||
"json-schema": "^0.4.0",
|
||||
"lodash": "^4.17.21",
|
||||
"uuid": "^8.0.0"
|
||||
|
||||
@@ -54,7 +54,7 @@ export class SchemaValidEntityPolicy implements EntityPolicy {
|
||||
}
|
||||
|
||||
throw new Error(
|
||||
`Malformed envelope, ${error.dataPath || '<root>'} ${error.message}`,
|
||||
`Malformed envelope, ${error.instancePath || '<root>'} ${error.message}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ export function throwAjvError(
|
||||
|
||||
const error = errors[0];
|
||||
throw new TypeError(
|
||||
`${error.dataPath || '<root>'} ${error.message}${
|
||||
`${error.instancePath || '<root>'} ${error.message}${
|
||||
error.params
|
||||
? ` - ${Object.entries(error.params)
|
||||
.map(([key, val]) => `${key}: ${val}`)
|
||||
|
||||
@@ -74,7 +74,7 @@ export function entityKindSchemaValidator<T extends Entity>(
|
||||
// Only in the case where kind and/or apiVersion have enum mismatches AND
|
||||
// have NO other errors, we call it a soft error.
|
||||
const softCandidates = validate.errors?.filter(e =>
|
||||
['/kind', '/apiVersion'].includes(e.dataPath),
|
||||
['/kind', '/apiVersion'].includes(e.instancePath),
|
||||
);
|
||||
if (
|
||||
softCandidates?.length &&
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
"@backstage/errors": "^1.0.0",
|
||||
"@backstage/types": "^1.0.0",
|
||||
"@types/json-schema": "^7.0.6",
|
||||
"ajv": "^7.0.3",
|
||||
"ajv": "^8.10.0",
|
||||
"chokidar": "^3.5.2",
|
||||
"fs-extra": "10.0.1",
|
||||
"json-schema": "^0.4.0",
|
||||
|
||||
@@ -32,9 +32,9 @@ describe('compileConfigSchemas', () => {
|
||||
errors: [
|
||||
{
|
||||
keyword: 'type',
|
||||
dataPath: '/a',
|
||||
instancePath: '/a',
|
||||
schemaPath: '#/properties/a/type',
|
||||
message: 'should be string',
|
||||
message: 'must be string',
|
||||
params: { type: 'string' },
|
||||
},
|
||||
],
|
||||
@@ -46,9 +46,9 @@ describe('compileConfigSchemas', () => {
|
||||
errors: [
|
||||
{
|
||||
keyword: 'type',
|
||||
dataPath: '/b',
|
||||
instancePath: '/b',
|
||||
schemaPath: '#/properties/b/type',
|
||||
message: 'should be number',
|
||||
message: 'must be number',
|
||||
params: { type: 'number' },
|
||||
},
|
||||
],
|
||||
|
||||
@@ -57,11 +57,11 @@ export function compileConfigSchemas(
|
||||
},
|
||||
compile(visibility: ConfigVisibility) {
|
||||
return (_data, context) => {
|
||||
if (context?.dataPath === undefined) {
|
||||
if (context?.instancePath === undefined) {
|
||||
return false;
|
||||
}
|
||||
if (visibility && visibility !== 'backend') {
|
||||
const normalizedPath = context.dataPath.replace(
|
||||
const normalizedPath = context.instancePath.replace(
|
||||
/\['?(.*?)'?\]/g,
|
||||
(_, segment) => `/${segment}`,
|
||||
);
|
||||
@@ -77,10 +77,10 @@ export function compileConfigSchemas(
|
||||
metaSchema: { type: 'string' },
|
||||
compile(deprecationDescription: string) {
|
||||
return (_data, context) => {
|
||||
if (context?.dataPath === undefined) {
|
||||
if (context?.instancePath === undefined) {
|
||||
return false;
|
||||
}
|
||||
const normalizedPath = context.dataPath.replace(
|
||||
const normalizedPath = context.instancePath.replace(
|
||||
/\['?(.*?)'?\]/g,
|
||||
(_, segment) => `/${segment}`,
|
||||
);
|
||||
|
||||
@@ -244,21 +244,21 @@ describe('filterErrorsByVisibility', () => {
|
||||
const errors = [
|
||||
{
|
||||
keyword: 'something',
|
||||
dataPath: '/a',
|
||||
instancePath: '/a',
|
||||
schemaPath: '#/properties/a/something',
|
||||
params: {},
|
||||
message: 'a',
|
||||
},
|
||||
{
|
||||
keyword: 'something',
|
||||
dataPath: '/b',
|
||||
instancePath: '/b',
|
||||
schemaPath: '#/properties/b/something',
|
||||
params: {},
|
||||
message: 'b',
|
||||
},
|
||||
{
|
||||
keyword: 'something',
|
||||
dataPath: '/c',
|
||||
instancePath: '/c',
|
||||
schemaPath: '#/properties/c/something',
|
||||
params: {},
|
||||
message: 'c',
|
||||
@@ -314,35 +314,35 @@ describe('filterErrorsByVisibility', () => {
|
||||
const errors = [
|
||||
{
|
||||
keyword: 'type',
|
||||
dataPath: '/a',
|
||||
instancePath: '/a',
|
||||
schemaPath: '#/properties/a/type',
|
||||
params: { type: 'number' },
|
||||
message: 'a',
|
||||
},
|
||||
{
|
||||
keyword: 'type',
|
||||
dataPath: '/b',
|
||||
instancePath: '/b',
|
||||
schemaPath: '#/properties/b/type',
|
||||
params: { type: 'string' },
|
||||
message: 'b',
|
||||
},
|
||||
{
|
||||
keyword: 'type',
|
||||
dataPath: '/c',
|
||||
instancePath: '/c',
|
||||
schemaPath: '#/properties/c/type',
|
||||
params: { type: 'array' },
|
||||
message: 'c',
|
||||
},
|
||||
{
|
||||
keyword: 'type',
|
||||
dataPath: '/c',
|
||||
instancePath: '/c',
|
||||
schemaPath: '#/properties/c/type',
|
||||
params: { type: 'object' },
|
||||
message: 'd',
|
||||
},
|
||||
{
|
||||
keyword: 'type',
|
||||
dataPath: '/c',
|
||||
instancePath: '/c',
|
||||
schemaPath: '#/properties/c/type',
|
||||
params: { type: 'null' },
|
||||
message: 'e',
|
||||
@@ -373,21 +373,21 @@ describe('filterErrorsByVisibility', () => {
|
||||
const errors = [
|
||||
{
|
||||
keyword: 'required',
|
||||
dataPath: '/a',
|
||||
instancePath: '/a',
|
||||
schemaPath: '#/properties/o/required',
|
||||
params: { missingProperty: 'a' },
|
||||
message: 'a',
|
||||
},
|
||||
{
|
||||
keyword: 'required',
|
||||
dataPath: '/b',
|
||||
instancePath: '/b',
|
||||
schemaPath: '#/properties/o/required',
|
||||
params: { missingProperty: 'b' },
|
||||
message: 'b',
|
||||
},
|
||||
{
|
||||
keyword: 'required',
|
||||
dataPath: '/c',
|
||||
instancePath: '/c',
|
||||
schemaPath: '#/properties/o/required',
|
||||
params: { missingProperty: 'c' },
|
||||
message: 'c',
|
||||
|
||||
@@ -173,7 +173,7 @@ export function filterErrorsByVisibility(
|
||||
}
|
||||
|
||||
const vis =
|
||||
visibilityByDataPath.get(error.dataPath) ?? DEFAULT_CONFIG_VISIBILITY;
|
||||
visibilityByDataPath.get(error.instancePath) ?? DEFAULT_CONFIG_VISIBILITY;
|
||||
return vis && includeVisibilities.includes(vis);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ describe('loadConfigSchema', () => {
|
||||
expect(() =>
|
||||
schema2.process([...configs, { data: { key1: 3 }, context: 'test2' }]),
|
||||
).toThrow(
|
||||
'Config validation failed, Config should be string { type=string } at /key1',
|
||||
'Config validation failed, Config must be string { type=string } at /key1',
|
||||
);
|
||||
|
||||
await expect(
|
||||
@@ -142,7 +142,7 @@ describe('loadConfigSchema', () => {
|
||||
];
|
||||
|
||||
expect(() => schema.process(configs)).toThrow(
|
||||
'Config validation failed, Config should be number { type=number } at /key2',
|
||||
'Config validation failed, Config must be number { type=number } at /key2',
|
||||
);
|
||||
expect(schema.process(configs, { visibility: ['frontend'] })).toEqual([
|
||||
{
|
||||
@@ -151,7 +151,7 @@ describe('loadConfigSchema', () => {
|
||||
},
|
||||
]);
|
||||
expect(() => schema.process(configs, { visibility: ['secret'] })).toThrow(
|
||||
'Config validation failed, Config should be number { type=number } at /key2',
|
||||
'Config validation failed, Config must be number { type=number } at /key2',
|
||||
);
|
||||
});
|
||||
|
||||
@@ -203,12 +203,12 @@ describe('loadConfigSchema', () => {
|
||||
},
|
||||
]);
|
||||
expect(() => schema.process(mkConfig({ y: 1 }))).toThrow(
|
||||
'Config validation failed, Config should be string { type=string } at /nested/0/y',
|
||||
'Config validation failed, Config must be string { type=string } at /nested/0/y',
|
||||
);
|
||||
expect(() =>
|
||||
schema.process(mkConfig({ y: 1 }), { visibility: ['frontend'] }),
|
||||
).toThrow(
|
||||
'Config validation failed, Config should be string { type=string } at /nested/0/y',
|
||||
'Config validation failed, Config must be string { type=string } at /nested/0/y',
|
||||
);
|
||||
expect(
|
||||
schema.process(mkConfig({ x: 'a' }), { visibility: ['frontend'] }),
|
||||
@@ -229,7 +229,7 @@ describe('loadConfigSchema', () => {
|
||||
expect(() =>
|
||||
schema.process(mkConfig({ y: 'aaaa' }), { visibility: ['frontend'] }),
|
||||
).toThrow(
|
||||
'Config validation failed, Config should match pattern "^...$" { pattern=^...$ } at /nested/0/y',
|
||||
'Config validation failed, Config must match pattern "^...$" { pattern=^...$ } at /nested/0/y',
|
||||
);
|
||||
|
||||
// This is a bit of an edge case where we have a structural error, these should always be reported
|
||||
@@ -238,7 +238,7 @@ describe('loadConfigSchema', () => {
|
||||
visibility: ['frontend'],
|
||||
}),
|
||||
).toThrow(
|
||||
'Config validation failed, Config should be array { type=array } at /nested',
|
||||
'Config validation failed, Config must be array { type=array } at /nested',
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -273,7 +273,7 @@ describe('loadConfigSchema', () => {
|
||||
visibility: ['frontend'],
|
||||
}),
|
||||
).toThrow(
|
||||
"Config should have required property 'x a' { missingProperty=x a } at /other",
|
||||
"Config must have required property 'x a' { missingProperty=x a } at /other",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -41,11 +41,11 @@ export type LoadConfigSchemaOptions =
|
||||
};
|
||||
|
||||
function errorsToError(errors: ValidationError[]): Error {
|
||||
const messages = errors.map(({ dataPath, message, params }) => {
|
||||
const messages = errors.map(({ instancePath, message, params }) => {
|
||||
const paramStr = Object.entries(params)
|
||||
.map(([name, value]) => `${name}=${value}`)
|
||||
.join(' ');
|
||||
return `Config ${message || ''} { ${paramStr} } at ${dataPath}`;
|
||||
return `Config ${message || ''} { ${paramStr} } at ${instancePath}`;
|
||||
});
|
||||
const error = new Error(`Config validation failed, ${messages.join('; ')}`);
|
||||
(error as any).messages = messages;
|
||||
|
||||
@@ -53,7 +53,7 @@ export const DEFAULT_CONFIG_VISIBILITY: ConfigVisibility = 'backend';
|
||||
*/
|
||||
export type ValidationError = {
|
||||
keyword: string;
|
||||
dataPath: string;
|
||||
instancePath: string;
|
||||
schemaPath: string;
|
||||
params: Record<string, any>;
|
||||
propertyName?: string;
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
"@backstage/errors": "^1.0.0",
|
||||
"@backstage/plugin-tech-insights-common": "^0.2.4",
|
||||
"@backstage/plugin-tech-insights-node": "^0.2.8",
|
||||
"ajv": "^7.0.3",
|
||||
"ajv": "^8.10.0",
|
||||
"json-rules-engine": "^6.1.2",
|
||||
"lodash": "^4.17.21",
|
||||
"luxon": "^2.0.2",
|
||||
|
||||
@@ -7248,20 +7248,10 @@ ajv@^6.10.0, ajv@^6.10.1, ajv@^6.12.2, ajv@^6.12.4, ajv@^6.12.5, ajv@^6.5.5, ajv
|
||||
json-schema-traverse "^0.4.1"
|
||||
uri-js "^4.2.2"
|
||||
|
||||
ajv@^7.0.3:
|
||||
version "7.0.3"
|
||||
resolved "https://registry.npmjs.org/ajv/-/ajv-7.0.3.tgz#13ae747eff125cafb230ac504b2406cf371eece2"
|
||||
integrity sha512-R50QRlXSxqXcQP5SvKUrw8VZeypvo12i2IX0EeR5PiZ7bEKeHWgzgo264LDadUsCU42lTJVhFikTqJwNeH34gQ==
|
||||
dependencies:
|
||||
fast-deep-equal "^3.1.1"
|
||||
json-schema-traverse "^1.0.0"
|
||||
require-from-string "^2.0.2"
|
||||
uri-js "^4.2.2"
|
||||
|
||||
ajv@^8.0.0, ajv@^8.8.0:
|
||||
version "8.9.0"
|
||||
resolved "https://registry.npmjs.org/ajv/-/ajv-8.9.0.tgz#738019146638824dea25edcf299dcba1b0e7eb18"
|
||||
integrity sha512-qOKJyNj/h+OWx7s5DePL6Zu1KeM9jPZhwBqs+7DzP6bGOvqzVCSf0xueYmVuaC/oQ/VtS2zLMLHdQFbkka+XDQ==
|
||||
ajv@^8.0.0, ajv@^8.10.0, ajv@^8.8.0:
|
||||
version "8.10.0"
|
||||
resolved "https://registry.npmjs.org/ajv/-/ajv-8.10.0.tgz#e573f719bd3af069017e3b66538ab968d040e54d"
|
||||
integrity sha512-bzqAEZOjkrUMl2afH8dknrq5KEk2SrwdBROR+vH1EKVQTqaUbJVPdc/gEdggTMM0Se+s+Ja4ju4TlNcStKl2Hw==
|
||||
dependencies:
|
||||
fast-deep-equal "^3.1.1"
|
||||
json-schema-traverse "^1.0.0"
|
||||
|
||||
Reference in New Issue
Block a user