From 5b5f1d8877981dab7b10cc80070f4c0e03f65bca Mon Sep 17 00:00:00 2001 From: "g. nicholas d'andrea" Date: Sat, 6 Jan 2024 22:32:41 -0500 Subject: [PATCH] Render const values in schema dropdown summaries --- .../utils/generateFriendlyName.tsx | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 web/src/theme/JSONSchemaViewer/utils/generateFriendlyName.tsx diff --git a/web/src/theme/JSONSchemaViewer/utils/generateFriendlyName.tsx b/web/src/theme/JSONSchemaViewer/utils/generateFriendlyName.tsx new file mode 100644 index 00000000..e3bd483a --- /dev/null +++ b/web/src/theme/JSONSchemaViewer/utils/generateFriendlyName.tsx @@ -0,0 +1,20 @@ +import React from 'react'; +import GenerateFriendlyName from '@theme-original/JSONSchemaViewer/utils/generateFriendlyName'; + +export default function GenerateFriendlyNameWrapper(props) { + const { schema } = props; + + // otherwise just use default rendering + return ( + <> + + { + "const" in schema + ? + <> = {JSON.stringify(schema.const)} + + : <> + } + + ); +}