swagger-api / swagger-api/swagger-codegen

[HTML2] Codegen : wont generate settings if [] is used in parameter name,

Open
#4,940 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

When using [ or ] in the name of a parameter, this will be used as name of the parameters. In the Online Swagger Editor this will show up, including the rest of the configuration of the parameter, like Description, required, format or default.

But when i'm generating a client version in HTML2, the name will show up as the name of the parameter, but the other settings like: Description, Required, Format or Default value wont be generated.

Swagger-codegen version

swagger-codegen-cli-2.2.2.jar

Swagger declaration file content:
```
/libs/sample_parameters.json:
  post:
  operationId: sample_parameters
  
  parameters:
    - name: blocks[dashboards][0][name]
      in: query
      description: name of the dashboard
      required: true
      type: string

    - name: blocks[dashboards][0][activeBlocks][]
      in: query
      description: the names of Active Blocks
      required: false
      type: string

    - name: blocks[dashboards][0][inactiveBlocks][]
      in: query
      description: the names of Inactive Blocks
      required: false
      type: string
      
    - host:
      name: host
      in: query
      description: IP of the Host you want receiving data from
      type: string
      format: 'x.x.x.x'
      required: true
      default: 127.0.0.1          

  tags:
    - sample
 
  responses:   
    200:
      description: response disc ....   
```

Output in the online Swagger Editor:
yaml-online

When generated with codegen to HTML2:
html2-codegen

Command line used for generation

export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ generate -i dashboard.yaml -l html2 -o /var/www/"

java $JAVA_OPTS -jar $executable $ags

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the HTML2 output using dashboard.yaml and the sample_parameters.json declaration shown in the issue, starting with the HTML2 generator entry point and its templates. Compare parameters containing [] with the generated output. Done means descriptions, required flags, formats, and default values are preserved alongside those parameter names.

Written by the indexing model from the issue text.

Assessment

Tech stack
html
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.