Merge pull request #974 from DaleSeo/anyof-description
Show description for anyOf fields in JSON editor
This commit is contained in:
commit
fe393e514a
2 changed files with 4 additions and 0 deletions
|
|
@ -757,6 +757,7 @@ const DynamicJsonForm = forwardRef<DynamicJsonFormRef, DynamicJsonFormProps>(
|
||||||
debouncedUpdateParent(newValue);
|
debouncedUpdateParent(newValue);
|
||||||
}}
|
}}
|
||||||
error={jsonError}
|
error={jsonError}
|
||||||
|
placeholder={schema.description}
|
||||||
/>
|
/>
|
||||||
) : // If schema type is object but value is not an object or is empty, and we have actual JSON data,
|
) : // If schema type is object but value is not an object or is empty, and we have actual JSON data,
|
||||||
// render a simple representation of the JSON data
|
// render a simple representation of the JSON data
|
||||||
|
|
|
||||||
|
|
@ -8,12 +8,14 @@ interface JsonEditorProps {
|
||||||
value: string;
|
value: string;
|
||||||
onChange: (value: string) => void;
|
onChange: (value: string) => void;
|
||||||
error?: string;
|
error?: string;
|
||||||
|
placeholder?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const JsonEditor = ({
|
const JsonEditor = ({
|
||||||
value,
|
value,
|
||||||
onChange,
|
onChange,
|
||||||
error: externalError,
|
error: externalError,
|
||||||
|
placeholder,
|
||||||
}: JsonEditorProps) => {
|
}: JsonEditorProps) => {
|
||||||
const [editorContent, setEditorContent] = useState(value || "");
|
const [editorContent, setEditorContent] = useState(value || "");
|
||||||
const [internalError, setInternalError] = useState<string | undefined>(
|
const [internalError, setInternalError] = useState<string | undefined>(
|
||||||
|
|
@ -48,6 +50,7 @@ const JsonEditor = ({
|
||||||
Prism.highlight(code, Prism.languages.json, "json")
|
Prism.highlight(code, Prism.languages.json, "json")
|
||||||
}
|
}
|
||||||
padding={10}
|
padding={10}
|
||||||
|
placeholder={placeholder}
|
||||||
style={{
|
style={{
|
||||||
fontFamily: '"Fira code", "Fira Mono", monospace',
|
fontFamily: '"Fira code", "Fira Mono", monospace',
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue