Contributions
Re: Use the Codegen Go generator to produce a go module
hi - not sure if you saw the attachment. I put the petstore API spec into petstore.json and used the following text in aMakefile. This depends on having Docker desktop (and Xcode on my MacBook) installed. ----------Makefile-------------- # # GOMOD_GENERATOR = swaggerapi/swagger-codegen-cli generate -l go SPEC_GENERATOR = swaggerapi/swagger-codegen-cli generate -l openapi --additional-properties=outputFile all: petstore petstore: petstore/go.mod petstore.json petstore.json: @curl https://petstore.swagger.io/v2/swagger.json > petstore.json # Use a containerized Go Makefile and Dockerfile # docker run --rm -v "$(PWD)/$(@D)":/usr/local/go/src/client golang:1.16 go build client %/go.mod: %.json docker run --rm -v "$(PWD):/src" -w /src $(GOMOD_GENERATOR) \ -i $< -o $(@D) \ --additional-properties=generateInterfaces=true \ --additional-properties=GoSubmodule=true \ --additional-properties=packageName=$(@D) \1.2KViews0likes0CommentsRe: Use the Codegen Go generator to produce a go module
I'm using this to generate the go code for an API spec - the expected output includes a go.mod file in the output directory. Cheers, Paul PAUL ROSHAM // Systems Engineer | Pure Storage, Inc. *Level 18, 567 Collins Street Melbourne, VIC 3000, Australia* +61 411 198 989 <+61-411-198989> | prosham@purestorage.com1.3KViews0likes1Comment