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][html2] HTML2-Generator not displaying query parameters properly #9384

Open
5 of 6 tasks
kas1337 opened this issue May 3, 2021 · 0 comments
Open
5 of 6 tasks

Comments

@kas1337
Copy link

kas1337 commented May 3, 2021

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

html2 generator ignores "default" and "enum" field and the resulting url is missing a value for the query parameter.

openapi-generator version

5.1.0

OpenAPI declaration file content or url
 "servers" : [ {
    "url" : "https://my-cookies/"
  } ],
  "paths" : {
    "/api/v4/cookies/amount" : {
      "get" : {
        "summary" : "Summary",
        "description" : "Description",
        "operationId" : "get_amount",
        "parameters" : [{
          "name" : "color",
          "in" : "query",
          "description" : "Cookie color",
          "schema" : {
            "type" : "string",
            "default" : "red",
            "enum" : [ "red", "blue", "green", "yellow" ]
          }
        } ],

The entire json file and the resulting index.html file can be found here: https://gist.github.com/kas1337/7381b3764fdfe340e272958e5a9a19b8

Generation Details & Steps to reproduce

I've tested with the latest master branch as described here https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-to-test-with-the-latest-master-of-openapi-generator using the following command (Linux)

java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g html2 -i openapi.json
Actual output

The resulting url in the generated documentation is missing the query parameter.

/api/v4/cookies/amount

In the CURL example the query parameter is visible but it looks like it's missing a value

curl -X GET\
 -H "Accept: application/pdf,application/json"\
 "https://my-cookies/api/v4/cookies/amount?color="

Furthermore, the "default" and "enum" fields are missing in the parameters section. Only the description is displayed.

Expected output

I would expect something like this for the url

/api/v4/cookies/amount?color={example_color}

as well as for the CURL example.

It would be nice if you could have a look into this. Thanks!

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

No branches or pull requests

1 participant