Have you considered reversing the workflow? You write the OpenAPI spec, and have a code generator produce the Schemas and server boilerplate?
If that's ok, check out my project :) https://github.com/deepmap/oapi-codegen We successfully use it for many API's in production. -- Marcin On Thu, Sep 3, 2020 at 12:06 AM Johann Höchtl <johann.hoec...@gmail.com> wrote: > > Hi, > I would like to accomplish the following: > > An existing golang package on github provides a struct definition I am > interested in to be used as part of a REST API interface I design > > 1. I would like to automatically go generate json schema for this > struct > 2. I would like to incorporate this generated schema into an OpenAPI > definition and generate go boilerplate for that > > > For step 2 I am using https://github.com/deepmap/oapi-codegen which works > great. It also supports $ref to external schemas. > > Still looking to accomplish step 1: I am searching for a tool which go > generates JSON schema from a golang source file or package. Any help? > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/f0e099de-7008-478d-ba92-f2febd0c40bdn%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/f0e099de-7008-478d-ba92-f2febd0c40bdn%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CA%2Bv29LsfOjw%3DDr17Syv0cidRZJq1zG3KATSKdT%3Dq-5LG_FCBEA%40mail.gmail.com.