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 ba0f6621..67f254ef 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
@@ -63,6 +63,7 @@ const JSONSchema = forwardRef(({ schema, name, onExpand }, ref) => {
"KeywordUnevaluatedProperties"
)
const KeywordType = useComponent("KeywordType")
+ const KeywordEnum = useComponent("KeywordEnum")
const KeywordConst = useComponent("KeywordConst")
const KeywordFormat = useComponent("KeywordFormat")
const KeywordTitle = useComponent("KeywordTitle")
@@ -158,6 +159,7 @@ const JSONSchema = forwardRef(({ schema, name, onExpand }, ref) => {
>
)}
+
diff --git a/src/core/plugins/json-schema-2020-12/components/keywords/Enum/Enum.jsx b/src/core/plugins/json-schema-2020-12/components/keywords/Enum/Enum.jsx
new file mode 100644
index 00000000..dd47f3f9
--- /dev/null
+++ b/src/core/plugins/json-schema-2020-12/components/keywords/Enum/Enum.jsx
@@ -0,0 +1,40 @@
+/**
+ * @prettier
+ */
+import React from "react"
+
+import { schema } from "../../../prop-types"
+import { useFn } from "../../../hooks"
+
+const Enum = ({ schema }) => {
+ const fn = useFn()
+
+ if (!Array.isArray(schema?.enum)) return null
+
+ return (
+
+
+ Allowed values
+
+
+ {schema.enum.map((element) => {
+ const strigifiedElement = fn.stringify(element)
+
+ return (
+ -
+
+ {strigifiedElement}
+
+
+ )
+ })}
+
+
+ )
+}
+
+Enum.propTypes = {
+ schema: schema.isRequired,
+}
+
+export default Enum
diff --git a/src/core/plugins/json-schema-2020-12/components/keywords/Enum/_enum.scss b/src/core/plugins/json-schema-2020-12/components/keywords/Enum/_enum.scss
new file mode 100644
index 00000000..525cebf8
--- /dev/null
+++ b/src/core/plugins/json-schema-2020-12/components/keywords/Enum/_enum.scss
@@ -0,0 +1,12 @@
+.json-schema-2020-12-keyword--enum {
+ & > ul {
+ display: inline-block;
+ padding: 0;
+ margin: 0;
+
+ li {
+ display: inline;
+ list-style-type: none;
+ }
+ }
+}
diff --git a/src/core/plugins/json-schema-2020-12/components/keywords/_all.scss b/src/core/plugins/json-schema-2020-12/components/keywords/_all.scss
index 4ef2d233..d320eb98 100644
--- a/src/core/plugins/json-schema-2020-12/components/keywords/_all.scss
+++ b/src/core/plugins/json-schema-2020-12/components/keywords/_all.scss
@@ -66,3 +66,4 @@
@import './Title/title';
@import './Properties/properties';
@import './PatternProperties/pattern-properties';
+@import './Enum/enum';
diff --git a/src/core/plugins/json-schema-2020-12/fn.js b/src/core/plugins/json-schema-2020-12/fn.js
index 178d4400..e585121c 100644
--- a/src/core/plugins/json-schema-2020-12/fn.js
+++ b/src/core/plugins/json-schema-2020-12/fn.js
@@ -160,6 +160,7 @@ export const isExpandable = (schema) => {
fn.hasKeyword(schema, "unevaluatedItems") ||
fn.hasKeyword(schema, "unevaluatedProperties") ||
schema?.description ||
+ schema?.enum ||
fn.hasKeyword(schema, "const")
)
}
diff --git a/src/core/plugins/json-schema-2020-12/hoc.jsx b/src/core/plugins/json-schema-2020-12/hoc.jsx
index f5ac3723..c529bfa3 100644
--- a/src/core/plugins/json-schema-2020-12/hoc.jsx
+++ b/src/core/plugins/json-schema-2020-12/hoc.jsx
@@ -31,6 +31,7 @@ import KeywordPropertyNames from "./components/keywords/PropertyNames"
import KeywordUnevaluatedItems from "./components/keywords/UnevaluatedItems"
import KeywordUnevaluatedProperties from "./components/keywords/UnevaluatedProperties"
import KeywordType from "./components/keywords/Type/Type"
+import KeywordEnum from "./components/keywords/Enum/Enum"
import KeywordConst from "./components/keywords/Const"
import KeywordFormat from "./components/keywords/Format/Format"
import KeywordTitle from "./components/keywords/Title/Title"
@@ -80,6 +81,7 @@ export const withJSONSchemaContext = (Component, overrides = {}) => {
KeywordUnevaluatedItems,
KeywordUnevaluatedProperties,
KeywordType,
+ KeywordEnum,
KeywordConst,
KeywordFormat,
KeywordTitle,
diff --git a/src/core/plugins/json-schema-2020-12/index.js b/src/core/plugins/json-schema-2020-12/index.js
index c7cc795d..0dad27c2 100644
--- a/src/core/plugins/json-schema-2020-12/index.js
+++ b/src/core/plugins/json-schema-2020-12/index.js
@@ -29,6 +29,7 @@ import KeywordPropertyNames from "./components/keywords/PropertyNames"
import KeywordUnevaluatedItems from "./components/keywords/UnevaluatedItems"
import KeywordUnevaluatedProperties from "./components/keywords/UnevaluatedProperties"
import KeywordType from "./components/keywords/Type/Type"
+import KeywordEnum from "./components/keywords/Enum/Enum"
import KeywordConst from "./components/keywords/Const"
import KeywordFormat from "./components/keywords/Format/Format"
import KeywordTitle from "./components/keywords/Title/Title"
@@ -69,6 +70,7 @@ const JSONSchema202012Plugin = () => ({
JSONSchema202012KeywordUnevaluatedItems: KeywordUnevaluatedItems,
JSONSchema202012KeywordUnevaluatedProperties: KeywordUnevaluatedProperties,
JSONSchema202012KeywordType: KeywordType,
+ JSONSchema202012KeywordEnum: KeywordEnum,
JSONSchema202012KeywordConst: KeywordConst,
JSONSchema202012KeywordFormat: KeywordFormat,
JSONSchema202012KeywordTitle: KeywordTitle,
diff --git a/src/core/plugins/oas31/wrap-components/models.jsx b/src/core/plugins/oas31/wrap-components/models.jsx
index 0890a99c..e4fd62cc 100644
--- a/src/core/plugins/oas31/wrap-components/models.jsx
+++ b/src/core/plugins/oas31/wrap-components/models.jsx
@@ -56,6 +56,7 @@ const ModelsWrapper = createOnlyOAS31ComponentWrapper(({ getSystem }) => {
"JSONSchema202012KeywordUnevaluatedProperties"
)
const KeywordType = getComponent("JSONSchema202012KeywordType")
+ const KeywordEnum = getComponent("JSONSchema202012KeywordEnum")
const KeywordConst = getComponent("JSONSchema202012KeywordConst")
const KeywordFormat = getComponent("JSONSchema202012KeywordFormat")
const KeywordTitle = getComponent("JSONSchema202012KeywordTitle")
@@ -102,6 +103,7 @@ const ModelsWrapper = createOnlyOAS31ComponentWrapper(({ getSystem }) => {
KeywordUnevaluatedItems,
KeywordUnevaluatedProperties,
KeywordType,
+ KeywordEnum,
KeywordConst,
KeywordFormat,
KeywordTitle,