4 ms·
Don't see much of a reason to use it, its also important to mention that code generation goes both ways. You can generate the schema from a service in FastAPI o
by lyu07282 4y ago
Don't see much of a reason to use it, its also important to mention that code generation goes both ways. You can generate the schema from a service in FastAPI or Spring and generate the client code from that schema. There are already existing code and schema generators for almost every strongly typed language and web framework, including Go, Scala, Typescript, Java and Rust.
You never have to actually write any OpenAPI schema yourself nowadays.
This also doesn't seem to address the one problem I always had with OpenAPI: Polymorphic types. Mapping an OpenAPI schema between strongly typed languages like Scala or TypeScript. OpenAPI 3 supports this now with discriminators but most code or schema generators aren't supporting this very well or at all yet.
https://swagger.io/docs/specification/data-models/inheritance-and-polymorphism/ https://swagger.io/docs/specification/data-models/inheritanc...
- klysm 4y agoI share the pain of things not supporting discriminated unions. I had to do some very hacky things to make it work for the API I’m developing at the moment. When it does work though it is very very nice