libopenapi icon indicating copy to clipboard operation
libopenapi copied to clipboard

libopenapi to generate the model not just from bytes , but from go code too

Open chinglinwen opened this issue 1 year ago • 2 comments

from user point of view, I'm thinking what I'd like, hope this can bring some new ideas, or you can think of this as a feature request

a probable overview of the workflow:

  1. write go struct
  1. generate go code(an extra go file) (example openapi-gen)
  2. generate the final model (document.BuildV3Model()) from go code ( example )
  3. serve such json or yaml with http handler ( example )

some relate project I would like to libopenapi to be harmony with:

  • https://google.aip.dev/
  • https://github.com/googleapis/gapic-generator ( archived though )
  • https://github.com/googleapis/gapic-showcase/blob/main/schema/google/showcase/v1beta1/messaging.proto ( example protobuf define http stuff )

I'm thinking how could these all could work together, some kubernetes tool may have narrow scope, this where libopenapi could comes in ( a general rest api tool, provide simple method to generate openapi )

one idea, writing openapi.yaml are error prone and I'd expect all things go code ( abstract away the detail ) decompose things to go code, and so I can compose the whole spec definition from go code, so maybe it will be more maintainable ( the whole process )

chinglinwen avatar Dec 20 '23 17:12 chinglinwen

Trying to port Fuego to libopenapi.

Would love to have this feature, it would make the migration easier!

I might try to implement partially this feature for libopenapi

EwenQuim avatar Feb 27 '24 10:02 EwenQuim

Please feel free to contribute! This feature isn't on my immediate roadmap (I have no use for it myself right now), your PR would be welcome.

daveshanley avatar Feb 27 '24 11:02 daveshanley