OpenAPITools / OpenAPITools/openapi-generator

[go] Bug: Invalid generated code for client when apiKey in cookie is used.

Open
#1,600 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Description

The client code generated for go, when cookie option is used for apiKey (as described here: https://swagger.io/docs/specification/authentication/api-keys/ ) is broken.

openapi-generator version

3.3.4-SNAPSHOT (commit: 33016f279029d0d82884b5450cfd2d8ccd0957ea )

OpenAPI declaration file content or url

https://gist.github.com/dmascialino/016fd42979b4736658d91a303404dba9

Command line used for generation

openapi-generator generate -i api_defenition.yaml -g go -o openapi

Steps to reproduce
go build ./openapi
# openapi_example/openapi
openapi/api_default.go:67:8: key declared and not used

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the linked OpenAPI declaration, the shown openapi-generator command, and go build ./openapi. Inspect the generated openapi/api_default.go around line 67 and trace the Go client template or generator entry point responsible; done means the cookie apiKey client code builds without an unused key error.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, openapi
Domain
api, devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.