Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #9384
Closed
Open
Issue created May 03, 2021 by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items

[BUG][html2] HTML2-Generator not displaying query parameters properly

Created by: kas1337

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!

Assignee
Assign to
Time tracking