implement custom schema field
Compare changes
Files
2+ 10
− 1
@@ -16,6 +16,8 @@ import validator from '@rjsf/validator-ajv8';
@@ -38,13 +40,20 @@ function FunctionForm({
@@ -53,7 +62,7 @@ function FunctionForm({
this MR implements a custom SchemaField
that overwrites the default one (see https://rjsf-team.github.io/react-jsonschema-form/docs/advanced-customization/custom-widgets-fields#custom-schemafield). The reason why we want to do this is because we may want to add a custom uiSchema
from within the JSONschema
const {
fields: { SchemaField },
} = getDefaultRegistry();
const CustomSchemaField = (props: FieldProps) => {
if (props.schema.uiSchema) {
const uiSchema = {
...(props.uiSchema ? props.uiSchema : {}),
...props.schema.uiSchema,
};
return <SchemaField {...props} uiSchema={uiSchema} />;
}
return <SchemaField {...props} />;
};