Optional array query params with enum are always sent after try out with non empty params
See original GitHub issueQ&A (please complete the following information)
- OS: macOS
- Browser: chrom
- Version: Chrome Version 72.0.3626.96 (Official Build) (64-bit)
- Method of installation: https://editor.swagger.io/
- Swagger-UI version: Not sure
- Swagger/OpenAPI version: OpenAPI 3.0
Content & configuration
Example Swagger/OpenAPI definition:
openapi: '3.0.0'
info:
description: >-
Repro API
title: Repro API
version: '1.0'
paths:
/test:
get:
summary: Test get
parameters:
- name: fields
in: query
required: false
allowEmptyValue: false
schema:
type: array
items:
type: string
enum:
- friends
- family
example:
- friends
style: form
responses:
200:
description: Success!
content:
application/json:
schema:
type: object
properties:
id:
type: integer
name:
type: string
Swagger-UI configuration options:
Not sure; default?
No QueryStringConfig
Describe the bug youâre encountering
To reproduceâŚ
Steps to reproduce the behavior:
- Click on âGET /test Test getâ
- Click on âTry it outâ
- Deselect âfriendsâ by command+click; Or select âââ
- Click on âExecuteâ
- Check âRequest URLâ
Expected behavior
Expect âRequest URLâ being: https://editor.swagger.io/test
Screenshots
Additional context or thoughts
This issue is similar to but different from #4223. There will be no problem if array items donât have enum. The example is not required. It is there just to give a non-empty value to start with. As mentioned in the title, I do need to do a try out with some value(s) like âfriendsâ if there is no example. In another word, it seems I couldnât clear the field after the first, non-empty, try out.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:6
- Comments:14 (2 by maintainers)
Top Results From Across the Web
Using Enums as Request Parameters in Spring | Baeldung
Learn how to use enums as request parameters in Spring REST controllers and how to handle exceptions triggered by invalid input.
Read more >Pass Array into ASP.NET Core Route Query String
NET Core 3, while trying to pass in a string Array. I solved it by passing in the query parameter as a temporary...
Read more >Describing Parameters - Swagger
A constant parameter is always sent by the client, whereas the default value is something that the server uses if the parameter is...
Read more >Resolvers - Apollo GraphQL Docs
If you don't define a resolver for a particular field, Apollo Server automatically ... A query always "bottoms out" on fields that return...
Read more >MySQL 8.0 Reference Manual :: 11.3.5 The ENUM Type
An ENUM is a string object with a value chosen from a list of permitted values that are enumerated explicitly in the column...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This issue forced us to modify our validation and allow an empty string (which is a sort of a hack) as a query param, it would be great if selecting âââ option would just simply not send that param instead of sending it empty.
@h4sohail as a work around you can Ctrl+Left Click on any previously selected values to unselect them, nevertheless I agree with your suggestion: