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
Optional fields are being generated as any type in the TypeScript interfaces produced by code generation tools such as Swagger-CodeGen and OpenAPI-Generator.
The any type is something we could deal with. But if we are working with enums, then enums are not exported at all as the type is also set to any for the enum field. So the enum object is just empty.
Are there any known workarounds to preserve the type integrity? We read several articles about client libraries not supporting openapi 3.1.0 yet, but some of those articles are almost two years old.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
After switching to openapi 3.1.0 (supported by latest fastapi version) the openapi schema looks somehow like this.
Optional fields are being generated as
any
type in the TypeScript interfaces produced by code generation tools such as Swagger-CodeGen and OpenAPI-Generator.The
any
type is something we could deal with. But if we are working with enums, then enums are not exported at all as the type is also set toany
for the enum field. So the enum object is just empty.Are there any known workarounds to preserve the type integrity? We read several articles about client libraries not supporting openapi 3.1.0 yet, but some of those articles are almost two years old.
By the way. One project that is handling nullable types correctly is: https://github.com/ferdikoomen/openapi-typescript-codegen
Thanks for any support.
Beta Was this translation helpful? Give feedback.
All reactions