Skip to content

[BUG] can't generate consumes and produces media type #8099

@kannkyo

Description

@kannkyo

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

Openapi-generator can't generate consumes and produces media type.

openapi-generator version

master branch at a4f1d1b

OpenAPI declaration file content or url

https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml

Generation Details

When I execute bellow command to generate jemeter files,

git clone https://github.com/OpenAPITools/openapi-generator
mvn install -Dmaven.test.skip=true
./bin/generate-samples.sh bin/configs/other/jmeter.yaml 

jmeter fiels don't have media type in headers.

actual output

    <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group - addPet" enabled="true">
...
        <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true">
          <collectionProp name="HeaderManager.headers">
          </collectionProp>
        </HeaderManager>

expected output

    <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group - addPet" enabled="true">
...
        <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true">
          <collectionProp name="HeaderManager.headers">
            <elementProp name="" elementType="Header">
              <stringProp name="Header.name">Content-Type</stringProp>
              <stringProp name="Header.value">application/json</stringProp>
            </elementProp>
          </collectionProp>
        </HeaderManager>
Steps to reproduce

see "Generation Details"

Related issues/PRs

nothing

Suggest a fix

change https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/jmeter-client/api.mustache

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions