diff --git a/src/core/plugins/json-schema-2020-12/components/BooleanJSONSchema/BooleanJSONSchema.jsx b/src/core/plugins/json-schema-2020-12/components/BooleanJSONSchema/BooleanJSONSchema.jsx
deleted file mode 100644
index 2ad978971f1..00000000000
--- a/src/core/plugins/json-schema-2020-12/components/BooleanJSONSchema/BooleanJSONSchema.jsx
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * @prettier
- */
-import React from "react"
-import PropTypes from "prop-types"
-
-import { booleanSchema } from "../../prop-types"
-
-const BooleanJSONSchema = ({ schema, name }) => {
- return (
-
- {name}
- {schema ? "true" : "false"}
-
- )
-}
-
-BooleanJSONSchema.propTypes = {
- schema: booleanSchema.isRequired,
- name: PropTypes.string,
-}
-
-BooleanJSONSchema.defaultProps = {
- name: "",
-}
-
-export default BooleanJSONSchema
diff --git a/src/core/plugins/json-schema-2020-12/components/BooleanJSONSchema/_boolean-json-schema.scss b/src/core/plugins/json-schema-2020-12/components/BooleanJSONSchema/_boolean-json-schema.scss
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/src/core/plugins/json-schema-2020-12/components/JSONSchema/JSONSchema.jsx b/src/core/plugins/json-schema-2020-12/components/JSONSchema/JSONSchema.jsx
index 103aaa38568..053c2187c0d 100644
--- a/src/core/plugins/json-schema-2020-12/components/JSONSchema/JSONSchema.jsx
+++ b/src/core/plugins/json-schema-2020-12/components/JSONSchema/JSONSchema.jsx
@@ -25,7 +25,6 @@ const JSONSchema = ({ schema, name }) => {
const fn = useFn()
const [level, nextLevel] = useLevel()
const isEmbedded = useIsEmbedded()
- const BooleanJSONSchema = useComponent("BooleanJSONSchema")
const Accordion = useComponent("Accordion")
const KeywordProperties = useComponent("KeywordProperties")
const KeywordType = useComponent("KeywordType")
@@ -56,13 +55,6 @@ const JSONSchema = ({ schema, name }) => {
setExpandedDeeply(expandedDeeply)
}, [expandedDeeply])
- /**
- * Rendering handlers.
- */
- if (fn.isBooleanJSONSchema(schema)) {
- return
- }
-
return (
diff --git a/src/core/plugins/json-schema-2020-12/components/_all.scss b/src/core/plugins/json-schema-2020-12/components/_all.scss
index fd167eb0369..60f423e5a14 100644
--- a/src/core/plugins/json-schema-2020-12/components/_all.scss
+++ b/src/core/plugins/json-schema-2020-12/components/_all.scss
@@ -1,4 +1,3 @@
-@import './BooleanJSONSchema/boolean-json-schema';
@import './JSONSchema/json-schema';
@import './Accordion/accordion';
@import './ExpandDeepButton/expand-deep-button';
diff --git a/src/core/plugins/json-schema-2020-12/components/keywords/Description/Description.jsx b/src/core/plugins/json-schema-2020-12/components/keywords/Description/Description.jsx
index 0ca3c920455..fa6159e78a1 100644
--- a/src/core/plugins/json-schema-2020-12/components/keywords/Description/Description.jsx
+++ b/src/core/plugins/json-schema-2020-12/components/keywords/Description/Description.jsx
@@ -6,7 +6,7 @@ import React from "react"
import { schema } from "../../../prop-types"
const Description = ({ schema }) => {
- if (!schema.description) return null
+ if (!schema?.description) return null
return (
{schema.description}
diff --git a/src/core/plugins/json-schema-2020-12/components/keywords/Format/Format.jsx b/src/core/plugins/json-schema-2020-12/components/keywords/Format/Format.jsx
index 0486c42ea98..6af735a3210 100644
--- a/src/core/plugins/json-schema-2020-12/components/keywords/Format/Format.jsx
+++ b/src/core/plugins/json-schema-2020-12/components/keywords/Format/Format.jsx
@@ -6,7 +6,7 @@ import React from "react"
import { schema } from "../../../prop-types"
const Format = ({ schema }) => {
- if (!schema.format) return null
+ if (!schema?.format) return null
return {schema.format}
}
diff --git a/src/core/plugins/json-schema-2020-12/components/keywords/Properties.jsx b/src/core/plugins/json-schema-2020-12/components/keywords/Properties.jsx
index 8112f72ae64..f2ba3844f3a 100644
--- a/src/core/plugins/json-schema-2020-12/components/keywords/Properties.jsx
+++ b/src/core/plugins/json-schema-2020-12/components/keywords/Properties.jsx
@@ -9,12 +9,7 @@ import { useFn, useComponent } from "../../hooks"
const Properties = ({ schema }) => {
const fn = useFn()
const JSONSchema = useComponent("JSONSchema")
-
- if (fn.isBooleanJSONSchema(schema)) {
- return null
- }
-
- const properties = schema.properties || {}
+ const properties = schema?.properties || {}
if (Object.keys(properties).length === 0) {
return null
diff --git a/src/core/plugins/json-schema-2020-12/fn.js b/src/core/plugins/json-schema-2020-12/fn.js
index f2bcca9955c..84bd17bd77e 100644
--- a/src/core/plugins/json-schema-2020-12/fn.js
+++ b/src/core/plugins/json-schema-2020-12/fn.js
@@ -9,19 +9,19 @@ export const upperFirst = (value) => {
}
export const getTitle = (schema) => {
- if (schema.title) return upperFirst(schema.title)
- if (schema.$anchor) return upperFirst(schema.$anchor)
- if (schema.$id) return schema.$id
+ if (schema?.title) return upperFirst(schema.title)
+ if (schema?.$anchor) return upperFirst(schema.$anchor)
+ if (schema?.$id) return schema.$id
return ""
}
export const getType = (schema) => {
- if (Array.isArray(schema.type)) {
+ if (Array.isArray(schema?.type)) {
return schema.type.map(String).join(" | ")
}
- if (schema.type != null) {
+ if (schema?.type != null) {
return String(schema.type)
}
diff --git a/src/core/plugins/json-schema-2020-12/hoc.jsx b/src/core/plugins/json-schema-2020-12/hoc.jsx
index 9faa086886d..6d2cd7a9175 100644
--- a/src/core/plugins/json-schema-2020-12/hoc.jsx
+++ b/src/core/plugins/json-schema-2020-12/hoc.jsx
@@ -4,7 +4,6 @@
import React from "react"
import JSONSchema from "./components/JSONSchema/JSONSchema"
-import BooleanJSONSchema from "./components/BooleanJSONSchema/BooleanJSONSchema"
import KeywordProperties from "./components/keywords/Properties"
import KeywordType from "./components/keywords/Type/Type"
import KeywordFormat from "./components/keywords/Format/Format"
@@ -20,7 +19,6 @@ export const withJSONSchemaContext = (Component, overrides = {}) => {
const value = {
components: {
JSONSchema,
- BooleanJSONSchema,
KeywordProperties,
KeywordType,
KeywordFormat,
diff --git a/src/core/plugins/json-schema-2020-12/index.js b/src/core/plugins/json-schema-2020-12/index.js
index ee887dee25d..389958b9967 100644
--- a/src/core/plugins/json-schema-2020-12/index.js
+++ b/src/core/plugins/json-schema-2020-12/index.js
@@ -2,7 +2,6 @@
* @prettier
*/
import JSONSchema from "./components/JSONSchema/JSONSchema"
-import BooleanJSONSchema from "./components/BooleanJSONSchema/BooleanJSONSchema"
import KeywordProperties from "./components/keywords/Properties"
import KeywordType from "./components/keywords/Type/Type"
import KeywordFormat from "./components/keywords/Format/Format"
@@ -17,7 +16,6 @@ import { withJSONSchemaContext } from "./hoc"
const JSONSchema202012Plugin = () => ({
components: {
JSONSchema202012: JSONSchema,
- BooleanJSONSchema202012: BooleanJSONSchema,
JSONSchema202012KeywordProperties: KeywordProperties,
JSONSchema202012KeywordType: KeywordType,
JSONSchema202012KeywordFormat: KeywordFormat,
diff --git a/src/core/plugins/oas31/wrap-components/models.jsx b/src/core/plugins/oas31/wrap-components/models.jsx
index c2cecfe2e76..00b2c125123 100644
--- a/src/core/plugins/oas31/wrap-components/models.jsx
+++ b/src/core/plugins/oas31/wrap-components/models.jsx
@@ -9,7 +9,6 @@ const ModelsWrapper = createOnlyOAS31ComponentWrapper(({ getSystem }) => {
const { getComponent, fn } = getSystem()
const Models = getComponent("OAS31Models", true)
const JSONSchema = getComponent("JSONSchema202012")
- const BooleanJSONSchema = getComponent("BooleanJSONSchema202012")
const KeywordProperties = getComponent("JSONSchema202012KeywordProperties")
const KeywordType = getComponent("JSONSchema202012KeywordType")
const KeywordFormat = getComponent("JSONSchema202012KeywordFormat")
@@ -29,7 +28,6 @@ const ModelsWrapper = createOnlyOAS31ComponentWrapper(({ getSystem }) => {
},
components: {
JSONSchema,
- BooleanJSONSchema,
KeywordProperties,
KeywordType,
KeywordFormat,