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 3044c2f3..b957717b 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
@@ -72,6 +72,7 @@ const JSONSchema = forwardRef(
const KeywordContentSchema = useComponent("KeywordContentSchema")
const KeywordTitle = useComponent("KeywordTitle")
const KeywordDescription = useComponent("KeywordDescription")
+ const KeywordDefault = useComponent("KeywordDefault")
const ExpandDeepButton = useComponent("ExpandDeepButton")
/**
@@ -176,6 +177,7 @@ const JSONSchema = forwardRef(
schema={schema}
dependentRequired={dependentRequired}
/>
+
diff --git a/src/core/plugins/json-schema-2020-12/components/keywords/Default.jsx b/src/core/plugins/json-schema-2020-12/components/keywords/Default.jsx
new file mode 100644
index 00000000..9f35c2d6
--- /dev/null
+++ b/src/core/plugins/json-schema-2020-12/components/keywords/Default.jsx
@@ -0,0 +1,30 @@
+/**
+ * @prettier
+ */
+import React from "react"
+
+import { schema } from "../../prop-types"
+import { useFn } from "../../hooks"
+
+const Default = ({ schema }) => {
+ const fn = useFn()
+
+ if (!fn.hasKeyword(schema, "default")) return null
+
+ return (
+
+
+ Default
+
+
+ {fn.stringify(schema.default)}
+
+
+ )
+}
+
+Default.propTypes = {
+ schema: schema.isRequired,
+}
+
+export default Default
diff --git a/src/core/plugins/json-schema-2020-12/fn.js b/src/core/plugins/json-schema-2020-12/fn.js
index 83c563d3..d909e0d6 100644
--- a/src/core/plugins/json-schema-2020-12/fn.js
+++ b/src/core/plugins/json-schema-2020-12/fn.js
@@ -162,7 +162,8 @@ export const isExpandable = (schema) => {
schema?.description ||
schema?.enum ||
fn.hasKeyword(schema, "const") ||
- fn.hasKeyword(schema, "contentSchema")
+ fn.hasKeyword(schema, "contentSchema") ||
+ fn.hasKeyword(schema, "default")
)
}
diff --git a/src/core/plugins/json-schema-2020-12/hoc.jsx b/src/core/plugins/json-schema-2020-12/hoc.jsx
index bfe7c898..bca0437c 100644
--- a/src/core/plugins/json-schema-2020-12/hoc.jsx
+++ b/src/core/plugins/json-schema-2020-12/hoc.jsx
@@ -38,6 +38,7 @@ import KeywordDependentRequired from "./components/keywords/DependentRequired/De
import KeywordContentSchema from "./components/keywords/ContentSchema"
import KeywordTitle from "./components/keywords/Title/Title"
import KeywordDescription from "./components/keywords/Description/Description"
+import KeywordDefault from "./components/keywords/Default"
import Accordion from "./components/Accordion/Accordion"
import ExpandDeepButton from "./components/ExpandDeepButton/ExpandDeepButton"
import ChevronRightIcon from "./components/icons/ChevronRight"
@@ -92,6 +93,7 @@ export const withJSONSchemaContext = (Component, overrides = {}) => {
KeywordContentSchema,
KeywordTitle,
KeywordDescription,
+ KeywordDefault,
Accordion,
ExpandDeepButton,
ChevronRightIcon,
diff --git a/src/core/plugins/json-schema-2020-12/index.js b/src/core/plugins/json-schema-2020-12/index.js
index 0b2d78a9..1e06cd78 100644
--- a/src/core/plugins/json-schema-2020-12/index.js
+++ b/src/core/plugins/json-schema-2020-12/index.js
@@ -36,6 +36,7 @@ import KeywordDependentRequired from "./components/keywords/DependentRequired/De
import KeywordContentSchema from "./components/keywords/ContentSchema"
import KeywordTitle from "./components/keywords/Title/Title"
import KeywordDescription from "./components/keywords/Description/Description"
+import KeywordDefault from "./components/keywords/Default"
import Accordion from "./components/Accordion/Accordion"
import ExpandDeepButton from "./components/ExpandDeepButton/ExpandDeepButton"
import ChevronRightIcon from "./components/icons/ChevronRight"
@@ -79,6 +80,7 @@ const JSONSchema202012Plugin = () => ({
JSONSchema202012KeywordContentSchema: KeywordContentSchema,
JSONSchema202012KeywordTitle: KeywordTitle,
JSONSchema202012KeywordDescription: KeywordDescription,
+ JSONSchema202012KeywordDefault: KeywordDefault,
JSONSchema202012Accordion: Accordion,
JSONSchema202012ExpandDeepButton: ExpandDeepButton,
JSONSchema202012ChevronRightIcon: ChevronRightIcon,
diff --git a/src/core/plugins/oas31/wrap-components/models.jsx b/src/core/plugins/oas31/wrap-components/models.jsx
index ab2e07a7..eb93493c 100644
--- a/src/core/plugins/oas31/wrap-components/models.jsx
+++ b/src/core/plugins/oas31/wrap-components/models.jsx
@@ -70,6 +70,7 @@ const ModelsWrapper = createOnlyOAS31ComponentWrapper(({ getSystem }) => {
"JSONSchema202012KeywordDescription",
true
)
+ const KeywordDefault = getComponent("JSONSchema202012KeywordDefault")
const Accordion = getComponent("JSONSchema202012Accordion")
const ExpandDeepButton = getComponent("JSONSchema202012ExpandDeepButton")
const ChevronRightIcon = getComponent("JSONSchema202012ChevronRightIcon")
@@ -116,6 +117,7 @@ const ModelsWrapper = createOnlyOAS31ComponentWrapper(({ getSystem }) => {
KeywordContentSchema,
KeywordTitle,
KeywordDescription,
+ KeywordDefault,
Accordion,
ExpandDeepButton,
ChevronRightIcon,