Merge pull request #22998 from backstage/renovate/json-schema-library-9.x
fix(deps): update dependency json-schema-library to v9
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
---
|
||||
'@backstage/plugin-scaffolder-react': patch
|
||||
'@backstage/plugin-scaffolder': patch
|
||||
---
|
||||
|
||||
Updated dependency `json-schema-library` to `^9.0.0`.
|
||||
@@ -69,7 +69,7 @@
|
||||
"flatted": "3.3.1",
|
||||
"humanize-duration": "^3.25.1",
|
||||
"json-schema": "^0.4.0",
|
||||
"json-schema-library": "^7.3.9",
|
||||
"json-schema-library": "^9.0.0",
|
||||
"lodash": "^4.17.21",
|
||||
"luxon": "^3.0.0",
|
||||
"qs": "^6.9.4",
|
||||
|
||||
@@ -38,10 +38,11 @@ export const ReviewState = (props: ReviewStateProps) => {
|
||||
.map(([key, value]) => {
|
||||
for (const step of props.schemas) {
|
||||
const parsedSchema = new JSONSchema(step.mergedSchema);
|
||||
const definitionInSchema = parsedSchema.getSchema(
|
||||
`#/${key}`,
|
||||
props.formState,
|
||||
);
|
||||
const definitionInSchema = parsedSchema.getSchema({
|
||||
pointer: `#/${key}`,
|
||||
data: props.formState,
|
||||
});
|
||||
|
||||
if (definitionInSchema) {
|
||||
const backstageReviewOptions =
|
||||
definitionInSchema['ui:backstage']?.review;
|
||||
|
||||
@@ -17,7 +17,11 @@
|
||||
import { FieldValidation } from '@rjsf/utils';
|
||||
import type { JsonObject, JsonValue } from '@backstage/types';
|
||||
import { ApiHolder } from '@backstage/core-plugin-api';
|
||||
import { Draft07 as JSONSchema } from 'json-schema-library';
|
||||
import {
|
||||
Draft07 as JSONSchema,
|
||||
JsonError,
|
||||
JsonSchema,
|
||||
} from 'json-schema-library';
|
||||
import { createFieldValidation, extractSchemaFromStep } from '../../lib';
|
||||
import {
|
||||
CustomFieldValidator,
|
||||
@@ -30,6 +34,11 @@ export type FormValidation = {
|
||||
[name: string]: FieldValidation | FormValidation;
|
||||
};
|
||||
|
||||
const isJsonError = (
|
||||
value: JsonError | JsonSchema,
|
||||
): value is { type: 'error'; message: string } =>
|
||||
'type' in value && value.type === 'error';
|
||||
|
||||
/** @alpha */
|
||||
export const createAsyncValidators = (
|
||||
rootSchema: JsonObject,
|
||||
@@ -74,9 +83,23 @@ export const createAsyncValidators = (
|
||||
};
|
||||
|
||||
for (const [key, value] of Object.entries(current)) {
|
||||
const path = `${pathPrefix}/${key}`;
|
||||
const definitionInSchema = parsedSchema.getSchema(path, formData);
|
||||
const { schema, uiSchema } = extractSchemaFromStep(definitionInSchema);
|
||||
const pointer = `${pathPrefix}/${key}`;
|
||||
const definitionInSchema = parsedSchema.getSchema({
|
||||
pointer,
|
||||
data: formData,
|
||||
});
|
||||
|
||||
if (!definitionInSchema) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isJsonError(definitionInSchema)) {
|
||||
throw new Error(definitionInSchema.message);
|
||||
}
|
||||
|
||||
const { schema, uiSchema } = extractSchemaFromStep(
|
||||
definitionInSchema as JsonObject,
|
||||
);
|
||||
|
||||
const hasItems = definitionInSchema && definitionInSchema.items;
|
||||
|
||||
@@ -102,7 +125,7 @@ export const createAsyncValidators = (
|
||||
}
|
||||
};
|
||||
|
||||
if (definitionInSchema && 'ui:field' in definitionInSchema) {
|
||||
if ('ui:field' in definitionInSchema) {
|
||||
await doValidateItem(definitionInSchema, schema, uiSchema);
|
||||
} else if (hasItems && 'ui:field' in definitionInSchema.items) {
|
||||
await doValidate(definitionInSchema.items);
|
||||
@@ -113,7 +136,7 @@ export const createAsyncValidators = (
|
||||
await doValidate(propValue);
|
||||
}
|
||||
} else if (isObject(value)) {
|
||||
formValidation[key] = await validate(formData, path, value);
|
||||
formValidation[key] = await validate(formData, pointer, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
"git-url-parse": "^14.0.0",
|
||||
"humanize-duration": "^3.25.1",
|
||||
"json-schema": "^0.4.0",
|
||||
"json-schema-library": "^7.3.9",
|
||||
"json-schema-library": "^9.0.0",
|
||||
"jszip": "^3.10.1",
|
||||
"lodash": "^4.17.21",
|
||||
"luxon": "^3.0.0",
|
||||
|
||||
@@ -8853,7 +8853,7 @@ __metadata:
|
||||
flatted: 3.3.1
|
||||
humanize-duration: ^3.25.1
|
||||
json-schema: ^0.4.0
|
||||
json-schema-library: ^7.3.9
|
||||
json-schema-library: ^9.0.0
|
||||
lodash: ^4.17.21
|
||||
luxon: ^3.0.0
|
||||
qs: ^6.9.4
|
||||
@@ -8917,7 +8917,7 @@ __metadata:
|
||||
git-url-parse: ^14.0.0
|
||||
humanize-duration: ^3.25.1
|
||||
json-schema: ^0.4.0
|
||||
json-schema-library: ^7.3.9
|
||||
json-schema-library: ^9.0.0
|
||||
jszip: ^3.10.1
|
||||
lodash: ^4.17.21
|
||||
luxon: ^3.0.0
|
||||
@@ -15936,7 +15936,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@sagold/json-query@npm:^6.1.0":
|
||||
"@sagold/json-query@npm:^6.1.1":
|
||||
version: 6.1.1
|
||||
resolution: "@sagold/json-query@npm:6.1.1"
|
||||
dependencies:
|
||||
@@ -25323,7 +25323,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"deepmerge@npm:^4.2.2, deepmerge@npm:~4.3.0":
|
||||
"deepmerge@npm:^4.2.2, deepmerge@npm:^4.3.1, deepmerge@npm:~4.3.0":
|
||||
version: 4.3.1
|
||||
resolution: "deepmerge@npm:4.3.1"
|
||||
checksum: 2024c6a980a1b7128084170c4cf56b0fd58a63f2da1660dcfe977415f27b17dbe5888668b59d0b063753f3220719d5e400b7f113609489c90160bb9a5518d052
|
||||
@@ -27935,6 +27935,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"fast-copy@npm:^3.0.1":
|
||||
version: 3.0.2
|
||||
resolution: "fast-copy@npm:3.0.2"
|
||||
checksum: 47f584bcede08ab3198559d3e0e093a547d567715b86be2198da6e3366c3c73eed550d97b86f9fb90dae179982b89c15d68187def960f522cdce14bacdfc6184
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"fast-decode-uri-component@npm:^1.0.1":
|
||||
version: 1.0.1
|
||||
resolution: "fast-decode-uri-component@npm:1.0.1"
|
||||
@@ -32586,16 +32593,18 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"json-schema-library@npm:^7.3.9":
|
||||
version: 7.4.9
|
||||
resolution: "json-schema-library@npm:7.4.9"
|
||||
"json-schema-library@npm:^9.0.0":
|
||||
version: 9.1.3
|
||||
resolution: "json-schema-library@npm:9.1.3"
|
||||
dependencies:
|
||||
"@sagold/json-pointer": ^5.1.1
|
||||
"@sagold/json-query": ^6.1.0
|
||||
deepmerge: ^4.2.2
|
||||
"@sagold/json-query": ^6.1.1
|
||||
deepmerge: ^4.3.1
|
||||
fast-copy: ^3.0.1
|
||||
fast-deep-equal: ^3.1.3
|
||||
smtp-address-parser: 1.0.10
|
||||
valid-url: ^1.0.9
|
||||
checksum: 178a388bb7baf917a71ad369cfffa2952472e2bbffcdbc4711ed8b53b5d2b07aa882317c1479abc33c950667791047312fa1baa213502f128c38287cd726ff79
|
||||
checksum: 0fd5c0a23fa146cab9c0e3bdfa5da46e7139f750091a64ee4f3ee10f44d114ef8b2db2a41be7e8591b37ebed47c40057e1b418de420a1226d9a16ec9dca7b164
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -42025,7 +42034,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"smtp-address-parser@npm:^1.0.3":
|
||||
"smtp-address-parser@npm:1.0.10, smtp-address-parser@npm:^1.0.3":
|
||||
version: 1.0.10
|
||||
resolution: "smtp-address-parser@npm:1.0.10"
|
||||
dependencies:
|
||||
|
||||
Reference in New Issue
Block a user