There are a few code generators for swagger.  The answer kind of depends on 
which you are using, for example, 
https://github.com/OpenAPITools/openapi-generator can generate a whole 
project or just some packages. It depends on the flags used. 
In general, the *swagger generate client -f file.json* command should 
generate some files. The files contain go code, and make up a package. You 
need to put these files into a project directory, in its own separate 
directory named after the package name. There are resources on how to 
structure your go repository like this one 
<https://github.com/golang-standards/project-layout>. Then you import your 
generated package from another file ( could be main.go, or any other 
package and use it). 
The first step would be to read the generated code and familiarise yourself 
with the public API. 

On Wednesday, May 6, 2020 at 5:31:15 PM UTC+1, RS wrote:
>
> Hi, 
> via *swagger generate client -f file.json* I have created client side 
> golang codes. The question is how can I use those generated codes for each 
> REST API in my golang project as consumer. 
> As a golang/swagger-newbie an example would be appreciated. 
>
> Thanks 
> Larisa 
>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/99014d96-09ae-44e9-a0c8-9f35b962170c%40googlegroups.com.

Reply via email to