@@ -1262,6 +1274,10 @@ exports[`JSONSchemaViewer - schema conditionally test If Then Else 1`] = `
>
string
+
+
diff --git a/src/theme/JSONSchemaViewer/components/SchemaItem/SchemaItem.tsx b/src/theme/JSONSchemaViewer/components/SchemaItem/SchemaItem.tsx
index d9d47764..7ffb416e 100644
--- a/src/theme/JSONSchemaViewer/components/SchemaItem/SchemaItem.tsx
+++ b/src/theme/JSONSchemaViewer/components/SchemaItem/SchemaItem.tsx
@@ -8,6 +8,7 @@ import {
DeprecatedLabel,
WriteOnlyLabel,
ReadOnlyLabel,
+ ConstantLabel
} from "@theme/JSONSchemaViewer/labels"
import { GenerateFriendlyName } from "@theme/JSONSchemaViewer/utils"
@@ -43,6 +44,10 @@ export default function SchemaItem({
typeof typedSchema !== "boolean" && typedSchema.readOnly === true
let isWriteOnly =
typeof typedSchema !== "boolean" && typedSchema.writeOnly === true
+ let isConstant =
+ typeof typedSchema !== "boolean" &&
+ (typedSchema.const !== undefined ||
+ (Array.isArray(typedSchema.enum) && typedSchema.enum.length === 1))
let isRequired = !isDeprecated && required
// Header
@@ -58,6 +63,8 @@ export default function SchemaItem({
{isReadOnly && }
{isWriteOnly && <> >}
{isWriteOnly && }
+ {isConstant && <> >}
+ {isConstant && }
>
)
diff --git a/src/theme/JSONSchemaViewer/labels/Constant/Constant.tsx b/src/theme/JSONSchemaViewer/labels/Constant/Constant.tsx
new file mode 100644
index 00000000..d0a8c87e
--- /dev/null
+++ b/src/theme/JSONSchemaViewer/labels/Constant/Constant.tsx
@@ -0,0 +1,18 @@
+import React from "react"
+import Translate from "@docusaurus/Translate"
+
+import styles from "./styles.module.css"
+
+export default function ConstantLabel(): JSX.Element {
+ return (
+
+
+ {"constant"}
+
+
+ )
+ }
\ No newline at end of file
diff --git a/src/theme/JSONSchemaViewer/labels/Constant/styles.module.css b/src/theme/JSONSchemaViewer/labels/Constant/styles.module.css
new file mode 100644
index 00000000..f0f789b2
--- /dev/null
+++ b/src/theme/JSONSchemaViewer/labels/Constant/styles.module.css
@@ -0,0 +1,4 @@
+.constant {
+ font-size: var(--ifm-code-font-size);
+ color: var(--ifm-color-secondary-darkest);
+}
\ No newline at end of file
diff --git a/src/theme/JSONSchemaViewer/labels/index.ts b/src/theme/JSONSchemaViewer/labels/index.ts
index 0522de29..9bd32f92 100644
--- a/src/theme/JSONSchemaViewer/labels/index.ts
+++ b/src/theme/JSONSchemaViewer/labels/index.ts
@@ -22,3 +22,4 @@ export { default as AndLabel } from "@theme/JSONSchemaViewer/labels/And"
export { default as OrLabel } from "@theme/JSONSchemaViewer/labels/Or"
export { default as NotLabel } from "@theme/JSONSchemaViewer/labels/Not"
export { default as XorLabel } from "@theme/JSONSchemaViewer/labels/Xor"
+export { default as ConstantLabel } from "@theme/JSONSchemaViewer/labels/Constant/Constant"
\ No newline at end of file