JSON Schema Form: AJV customFormats

TLDR:

Request to be able to pass customFormats to a Retool JSON Schema Form component. Possibly customFormats with custom validation functions that use imported modules.

Preamble:

I have a JSON schema that uses a custom format called "base-subnet".

E.g.

...
"properties": {
                "src_subnets": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "format": "base-subnet"
                  }
                }
              }
...

Retool's JSON Schema Form obviously doesn't know the customFormat, so doesn't validate the field.

In my back end code I use AJV's addFormat method.

import Ajv from "ajv";
import { Netmask } from "netmask";

const ajv = new Ajv();

ajv.addFormat("base-subnet", {
  validate: (x: string) => {
    try {
      const [subnet, mask] = x.split("/");
      const block = new Netmask(`${subnet}/${mask}`);
      return block.base === subnet;
    } catch (err) {
      return false;
    }
  },
});

react-jsonschema-form does facilitate custom formats.

"Format values can be anything AJV’s addFormat method accepts."

Request
I would like to be able to pass customFormats (potentially using complex custom validation functions) to the Retool JSON Schema Form component so I can keep my front end and back end validation consistent.

Hey @Edward_Rose, thanks for the request! I've logged this internally and can update you here when I have any additional information on its status. Have a great day!