Open MentalGear opened 1 month ago
Update with Error code. Context: Converting to JSONSchema.
I suspect that Nano ID is not yet supported by the JSON Schema .format
property. Or am I wrong? We could theoretically support it by adding it's regex to the JSON Schema .pattern
property, but since Valibot is focused on bundle size, some of our regex use flags. So we can't just copy the regex used in all cases, as regex flags are not supported in JSON Schema as far as I know.
So far we only support common actions, but I plan to support more in the future. Are you interested in helping us implement them? As a workaround, you could force the conversion to ignore the nanoid
action.
toJsonSchema(v.pipe(v.string(), v.nanoid()), { force: true });
Is my valibot schema wrong? Otherwise I would expect this to pass since nanoid should be a constraint to string, the actual type is string. So JSONschema conversion should coarse it into a string.