feat(json-schema-2020-12): add support for type keyword

Refs #8513
This commit is contained in:
Vladimir Gorej
2023-04-14 14:23:37 +02:00
committed by Vladimír Gorej
parent 7cfc5e3656
commit f06c1caed5
10 changed files with 53 additions and 20 deletions

View File

@@ -1,7 +1,6 @@
/**
* @prettier
*/
export const upperFirst = (value) => {
if (typeof value === "string") {
return `${value.charAt(0).toUpperCase()}${value.slice(1)}`
@@ -17,4 +16,16 @@ export const getTitle = (schema) => {
return ""
}
export const getType = (schema) => {
if (Array.isArray(schema.type)) {
return schema.type.map(String).join(" | ")
}
if (schema.type != null) {
return String(schema.type)
}
return "any"
}
export const isBooleanJSONSchema = (schema) => typeof schema === "boolean"