swagger-api / swagger-api/swagger-codegen

Delete query array fields

Open
#8,439 2 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

Q&A (please complete the following information)
Content & configuration

If I generate server with java-resteasy and client with typescript-angular, when client call server the working way to delete a resource with list of ids is:

curl -X DELETE "https://localhost:8080/rest/test/?idCampi=1&idCampi=2" -H "accept: application/json"

but from swagger-ui the generated call is

curl -X DELETE "https://localhost:8080/rest/test/?idCampi=1,2" -H "accept: application/json"

that is not working with java-resteasy as server and typescript-angular as client.

Example Swagger/OpenAPI definition:

swagger: "2.0"
info:
  version: "1.0"
  title: "TEST"  
basePath: "/rest"
host: localhost:8080
paths: 
  /test/:
    delete:
      produces:
      - "application/json"  
      parameters:
       - name: "id"
         in: query
         description: "array of id"
         required: true
         type: array
         items: 
           type: "integer"
           format: "int64"
      responses:
        200:
          description: "test response"
          schema:
            type: "string"

Swagger-UI configuration options:

no config

Describe the bug you're encountering

From swagger-ui is not possible to delete a list of resources using array of element, because generated querystring is not generated and parsed correctly from java and angular.

To reproduce...

Steps to reproduce the behavior:

  1. Go to https://editor.swagger.io
  2. import provided yaml
  3. generate resteasy server, extract and run mvn install, then mvn tomcat:run
  4. run provided curl on localhost, changing server context
Expected behavior

I expect the same behaviour from swagger-ui and generated client and server

Screenshots

no screenshoot

Additional context or thoughts

This issue is a folloup from https://github.com/swagger-api/swagger-ui/issues/4736

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 with the supplied Swagger 2.0 definition and compare the generated Java Resteasy server and TypeScript Angular client requests for the array query parameter. Trace how array query values are serialized and parsed, then verify that the generated DELETE request uses repeated idCampi query keys and remains compatible with both outputs.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, java, typescript
Domain
api, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.