swagger-api / swagger-api/swagger-codegen

Array doesnt accept multiple entries in JAX-RS

Open
#2,961 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted Issue: Bug Server: Java
Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

I recently opened a bug in swagger-ui, but now I think its a problem with swagger codegen. This is the related post: https://github.com/swagger-api/swagger-ui/issues/2175

When I build Code out of a spec which has an Array the Code seems to be right, but when I run I can have max. 1 entry. It doesnt recognize a "," with the collectionFormat csv. It also doesnt work with a "|" when i choose pipe as collection Format. Here is the spec:

"parameters": [
  {
    "name": "api_key",
    "in": "header",
    "description": "description",
    "required": true,
    "type": "array",
    "items": {
      "type": "string"
    },
    "collectionFormat": "csv"
  }
]

Im build a JAX-RS -Jersey server and the swagger Codegen version is 2.1.6 and I run the Code with this:

-i swaggerPolicy.json \
  -l jaxrs \
  -o D:\Dateien\swagger_restacl_integration\SwaggerRestaclIntegration

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

Start by reproducing the issue with the provided swaggerPolicy.json and the jaxrs generator command. Inspect how the generated JAX-RS server binds the array header for csv and pipe collection formats. Done means multiple header entries are accepted using the separators specified by collectionFormat.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
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.