swagger-api / swagger-api/swagger-codegen
Delete query array fields
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)
- OS: Windows 10, version 1803,
- Browser: Firefox
- Version: 61.0.1
- Method of installation: indirectly by https://mvnrepository.com/artifact/org.webjars/swagger-ui/3.17.3
- Swagger-UI version: 3.17.3
- Swagger/OpenAPI version: Swagger 2.0
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:
- Go to https://editor.swagger.io
- import provided yaml
- generate resteasy server, extract and run mvn install, then mvn tomcat:run
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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