You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi anatine team, I keep running to this problem that I think if this feature is done, it would be a massive help DX-wise.
Currently, the type inferred from the AnatineSchemaObject has the example, examples, properties... all has any types => I lose all of the Intellisense/autocomplete goodness, and when running build/type checks, TypeScript cannot pick up the wrong attribute type.
Example:
import{z}from'zod'import{extendApi}from'@anatine/zod-openapi'constInput=z.object({name: z.string(),age: z.number(),})constInputSchema=extendApi(Input,{name: 'input'example: {// I don't have any autocomplete here.}})
This also leads to another problem when I convert it into a Nest DTO and then build into Swagger doc (like via @anatine/zod-nestjscreateZodDto), the generated example also has the wrong attribute name (because TypeScript could not pick up the wrong type structure) => break swagger examples.
perhaps this AnatineSchemaObject type can be converted into a Generic type that takes in the inferred type of the Schema instead of taking in ZodTypeAny ?
The text was updated successfully, but these errors were encountered:
Hi anatine team, I keep running to this problem that I think if this feature is done, it would be a massive help DX-wise.
Currently, the type inferred from the
AnatineSchemaObject
has theexample
,examples
,properties
... all hasany
types => I lose all of the Intellisense/autocomplete goodness, and when running build/type checks, TypeScript cannot pick up the wrong attribute type.Example:
This also leads to another problem when I convert it into a Nest DTO and then build into Swagger doc (like via
@anatine/zod-nestjs
createZodDto
), the generated example also has the wrong attribute name (because TypeScript could not pick up the wrong type structure) => break swagger examples.perhaps this
AnatineSchemaObject
type can be converted into a Generic type that takes in the inferred type of the Schema instead of taking inZodTypeAny
?The text was updated successfully, but these errors were encountered: