-
-
Notifications
You must be signed in to change notification settings - Fork 138
Open
Description
When trying out the recent Standard JSON Schema API like this:
const schema = type({
firstName: 'string = "First"',
lastName: 'string = "Last"',
});
const input = schema['~standard']['jsonSchema'].input({ target: "draft-07" });
console.log(input);I noticed that the JSON schema doesn't have default values included:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
}
}
}
When compared to other implementers like valibot and zod, I get the following:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"firstName": {
"default": "First",
"type": "string"
},
"lastName": {
"default": "Last",
"type": "string"
}
}
}
What I'm working on
I'm implementing a few functionalities that plan to consume standard JSON schemas for forms, one of those features is default value resolution in formwerkjs/formwerk#238
This will also be ported to vee-validate v5 since v4 had that capability via resolvers which is dropped in favor of standard schema support.
So is there any plans to support that? I'm not sure if there was a discussion about it. Happy to try PRing it if that's something arktype will be willing to support.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
To do