Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] can't generate security definitions like api key #8102

Closed
5 of 6 tasks
kannkyo opened this issue Dec 5, 2020 · 0 comments · Fixed by #8459
Closed
5 of 6 tasks

[BUG] can't generate security definitions like api key #8102

kannkyo opened this issue Dec 5, 2020 · 0 comments · Fixed by #8459

Comments

@kannkyo
Copy link
Contributor

kannkyo commented Dec 5, 2020

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 generate security definitions like api key.

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 api key in headers.

actual output

<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group - getPetById" 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 - getPetById" 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">api_key</stringProp>
              <stringProp name="Header.value">${__P(apiKey,key)}</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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant