Plans for a V2 #440
Replies: 1 comment 2 replies
-
I am in the process of implementing a Terraform provider for an OpenAPI based API. I thought that naturally we could generate the Terraform boilerplate from OpenAPI, but this implies that the generator would allow generating non-struct based schemas like the terraform schema.Ressource. For this, I think there should be more data extracted to template functions and data and less in the generator go codepaths. In essence, a more complete abstract model that can be manipulated in templates. This would allow, in templates, iteration on the OpenAPI definition and generation of many output forms, Terraform included. In short: Read in the OpenAPI -> transform in intermediate form -> feed to template. WDYT? |
Beta Was this translation helpful? Give feedback.
-
oapi-codegen was originally a quick little project to help us generate server code from OpenAPI specs at DeepMap, but it's grown quite a bit bigger than I expected.
I've started a v2-dev branch to work on breaking changes to both generated code and the runtime. My plans are as follows.
#/components/schemas
, so we never had to think about declaring types for anonymous types, such as response bodies which don't have a schema under#/components
. In my opinion, it is better for this package to be dumb, and leave the choice whether to declare a type or not based on the structure of the spec - inline types are anonymous, explicit types create Go types. It appears, though, that people have been pointing this code generator at specs which they don't control, so this gets annoying really quickly. I'm not sure how to best handle this yet.Beta Was this translation helpful? Give feedback.
All reactions