Bug Report Checklist
Description
Go's api.mustache template builds a Go client that adds header params as query params. The bug was introduced in this PR and still exists on the latest main branch.
openapi-generator version
This issue doesn't yet appear to be included in a release (the PR was merged on Nov 19, 2022, and the latest release was on Nov 1, 2022 [v6.2.1]).
That being said, the latest main branch includes this code. I'm using the openapi-generator-cli and docker without specifying a version and seem to be pulling in the changes from main.
OpenAPI declaration file content or url
Example yaml file with headers included:
swagger: "2.0"
info:
version: 1.0.0
title: Swagger Petstore
description: >
A sample API that uses a petstore as an example
to demonstrate features in the swagger-2.0 specification
consumes:
- application/json
produces:
- application/json
paths:
/pets:
get:
description: Returns all pets from the petstore
parameters:
- name: X-Region
in: header
type: string
required: true
responses:
"200":
description: pet response
schema:
type: array
items:
$ref: "#/definitions/pet"
default:
description: unexpected error
schema:
$ref: "#/definitions/errorModel"
definitions:
pet:
$ref: sample/pet.yaml
pet-owner:
$ref: sample/pet-owner.yaml
errorModel:
$ref: sample/error.json
Generation Details
I'm using the openapi-generator-cli and docker to generate my Go client.
Steps to reproduce
- Run openapi-generator-cli with docker on an OpenAPI spec yaml file that includes headers. Pull generated client code into a Go repo.
- Build requests using the above generated Golang client. Requests will not set header params at all (and instead it appears they will be added to query params).
Related issues/PRs
Suggest a fix
The fix should be minor - the api.mustache template needs a few lines updated to set headers instead of query params.
Bug Report Checklist
Description
Go's api.mustache template builds a Go client that adds header params as query params. The bug was introduced in this PR and still exists on the latest main branch.
openapi-generator version
This issue doesn't yet appear to be included in a release (the PR was merged on Nov 19, 2022, and the latest release was on Nov 1, 2022 [v6.2.1]).
That being said, the latest main branch includes this code. I'm using the openapi-generator-cli and docker without specifying a version and seem to be pulling in the changes from main.
OpenAPI declaration file content or url
Example yaml file with headers included:
Generation Details
I'm using the openapi-generator-cli and docker to generate my Go client.
Steps to reproduce
Related issues/PRs
Suggest a fix
The fix should be minor - the api.mustache template needs a few lines updated to set headers instead of query params.