I'm trying to use the json-schema-to-zod npm package to generate Zod schemas for these schema but there's a lot of properties listed that are marked as having a default value of null but only have "type": "string" instead of "type": ["string", "null"].
For specific examples you can look at harmonized_tariff_code and country_of_origin in create_shipments_request_body.json.
This is causing an issue with the json-schema-to-zod package since the generated Zod schema gives a type error: Argument of type 'null' is not assignable to parameter of type 'string'.
country_of_origin: z
.string()
.min(2)
.max(2)
.default(null),
It would be really helpful if the nullable properties were updated to include null in their allowed types (or if they aren't actually nullable, then remove the default values).
I'm trying to use the
json-schema-to-zodnpm package to generate Zod schemas for these schema but there's a lot of properties listed that are marked as having a default value ofnullbut only have"type": "string"instead of"type": ["string", "null"].For specific examples you can look at
harmonized_tariff_codeandcountry_of_originincreate_shipments_request_body.json.This is causing an issue with the
json-schema-to-zodpackage since the generated Zod schema gives a type error:Argument of type 'null' is not assignable to parameter of type 'string'.It would be really helpful if the nullable properties were updated to include
nullin their allowed types (or if they aren't actually nullable, then remove the default values).