feat(json-schema-2020-12): add support for const keyword (#8622)
Refs #8513
This commit is contained in:
@@ -159,6 +159,22 @@ export const isExpandable = (schema) => {
|
||||
fn.hasKeyword(schema, "propertyNames") ||
|
||||
fn.hasKeyword(schema, "unevaluatedItems") ||
|
||||
fn.hasKeyword(schema, "unevaluatedProperties") ||
|
||||
schema?.description
|
||||
schema?.description ||
|
||||
fn.hasKeyword(schema, "const")
|
||||
)
|
||||
}
|
||||
|
||||
export const stringify = (value) => {
|
||||
if (
|
||||
value === null ||
|
||||
["number", "bigint", "boolean"].includes(typeof value)
|
||||
) {
|
||||
return String(value)
|
||||
}
|
||||
|
||||
if (Array.isArray(value)) {
|
||||
return `[${value.map(stringify).join(", ")}]`
|
||||
}
|
||||
|
||||
return JSON.stringify(value)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user