这是 stackbiltz 链接:
https ://stackblitz.com/edit/angular-zvsitp
我已将架构更改为下面提到的代码,并且在控制台中没有看到错误。
schema = {
$schema: "http://json-schema.org/draft-07/schema#",
type: "object",
title: "Product Variant",
additionalProperties: false,
definitions: {
int: {
type: "number",
minimum: 0,
maximum: 10
},
string: {
type: "string",
minLength: 0
},
valueItem: {
type: "object",
properties: { value: { $ref: "#/definitions/int" } }
},
valueItemArray: {
type: "array",
items: { $ref: "#/definitions/valueItemArray" }
},
dtoArray: {
type: "array",
items: { $ref: "#/properties/staffLanguageLevelDto" }
},
},
properties: {
staffLanguageLevelDto: {
type: "object",
properties: {
id: { $ref: "#/definitions/int" },
staffId: {
allOf: [
{ $ref: "#/definitions/int" },
{ maximum: 5, title: "staffId (overriden maximum)" }
]
},
languageId: {
allOf: [
{ $ref: "#/definitions/valueItem" },
{ title: "languageId (object with custom title)" }
]
},
languageLevelId: { $ref: "#/definitions/int" },
languageName2: {
allOf: [
{ $ref: "#/definitions/string" },
{
default: "ole",
maxLength: 3,
title: "languageName2 (custom default & maxLength)"
}
]
},
languageLevelName: { $ref: "#/definitions/dtoArray" }
}
}
}
};