danielgtaylor / openapi-cli-generator

Generate a CLI from an OpenAPI 3 specification
MIT License
181 stars 49 forks source link

"undefined: openapiRegister" error #25

Closed falzm closed 4 years ago

falzm commented 4 years ago

Hi,

I've tried to follow the instructions in the README of this project, however when reaching the go install step I get the following error:

$ go install
# github.com/exoscale/cli
./main.go:14:2: undefined: openapiRegister

Where is the openapiRegister() function supposed to come from? There's not such function definition in the files generated, did I miss something?

falzm commented 4 years ago

Figured out what the issue was: in your README example you use a file named openapi.yaml as parameter of your openapi-cli-generator generate command, and the file name is actually the prefix of the register function (openapiRegister()). In my case my OpenAPI spec file was named differently, and so was the generated register function to be put in the main.go file.

I suggest mentioning this in your documentation 😉