Custom field types

Hi, Thanks a lot for such great product. Please may anyone tell me that how to make custom field types. K mean by adding custom field type in schema a custom component should render. are there any given examples of it. Thanks

[original thread by aryankuntal2016]

Hi! Thanks for your interest in JSON Forms! In JSON Forms we use a tester-based system, this means for each UISchemaElement which shall be rendered the highest ranking tester wins and its associated renderer will be called. The tester can access the JSON Schema as well as the UI Schema to determine what it wants to return.

So if you want to render a custom type in your JSON Schema all you need to do is to register a renderer which checks for this type, e.g.

rankWith(
  100,
  schemaTypeIs('myCustomType')
);

Note that in general I would advise against introducing custom types as you’ll lose the interoperability with other frameworks like Ajv which no longer can validate your schema without further customizations and would like to recommend a UI schema approach. See this answer to a previous question for more information.