Thanks for making this great tool! It has helped us a lot generate API clients.
The problem
We have a schema definition without type: object defined but has required defined as an array of string, it's resolved as z.unknown() but actually should be treated as object with specified keys
Minimal reproducible example
A simplified schema definition to reproduce this is like:
I'd admit it's not friendly to omit type in schema definition, but it's optional both in OpenAPI specification or JSON Schema Validation Spec. A schema object without type might be treated as Any(type: {})
Thanks for making this great tool! It has helped us a lot generate API clients.
The problem
We have a schema definition without
type: object
defined but hasrequired
defined as an array of string, it's resolved asz.unknown()
but actually should be treated asobject
with specified keysMinimal reproducible example
A simplified schema definition to reproduce this is like:
The generated client code:
the expected
userResponse
schema isMore info
I'd admit it's not friendly to omit
type
in schema definition, but it's optional both in OpenAPI specification or JSON Schema Validation Spec. A schema object withouttype
might be treated as Any(type: {}
)And according to an official OpenAPI Q&A:
The https://editor.swagger.io/ can correctly resolve that
(I believe they did some merge on the finally resolved schema) and it can also pass this online validator