Closed wineTGH closed 1 month ago
Hello, yes file
are not a thing in JSON so we can't have a conversion to JSON schema.
You can generate an empty schema on files by doing:
toJSONSchema({
schema: file(),
customSchemaConversion: {
// Return an empty JSON schema (equivalent to `any`)
file: () => {
return {};
}
},
})
// => {}
That's a shame. I came here in the first place because of an error message in sveltekit superforms. I found something similar to validate non-JSON data, but not enough fields and no support for binary content format (which makes sense). Thanks for the reply
@wineTGH Can you contact the maintainers of sveltekit superforms ?
Of course js file could be serialized in JSON but it would need a custom serializer and then a custom schema conversion which is definitely possible with customSchemaConversion
Actually I see that they already encountered the same error on instance and just ignored it:
Thanks. I will open issue on their repo. This can be closed
Currently library just gives an error if you try to use it with file type in schema
Link to an File API docs