Skip to content

Commit faec883

Browse files
committed
fix: display description for anyOf fields in JSON editor
1 parent 1977e2a commit faec883

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

client/src/components/DynamicJsonForm.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,7 @@ const DynamicJsonForm = forwardRef<DynamicJsonFormRef, DynamicJsonFormProps>(
757757
debouncedUpdateParent(newValue);
758758
}}
759759
error={jsonError}
760+
placeholder={schema.description}
760761
/>
761762
) : // If schema type is object but value is not an object or is empty, and we have actual JSON data,
762763
// render a simple representation of the JSON data

client/src/components/JsonEditor.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ interface JsonEditorProps {
88
value: string;
99
onChange: (value: string) => void;
1010
error?: string;
11+
placeholder?: string;
1112
}
1213

1314
const JsonEditor = ({
1415
value,
1516
onChange,
1617
error: externalError,
18+
placeholder,
1719
}: JsonEditorProps) => {
1820
const [editorContent, setEditorContent] = useState(value || "");
1921
const [internalError, setInternalError] = useState<string | undefined>(
@@ -48,6 +50,7 @@ const JsonEditor = ({
4850
Prism.highlight(code, Prism.languages.json, "json")
4951
}
5052
padding={10}
53+
placeholder={placeholder}
5154
style={{
5255
fontFamily: '"Fira code", "Fira Mono", monospace',
5356
fontSize: 14,

0 commit comments

Comments
 (0)