You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For application/x-www-form-urlencoded request, given a stringified JSON param, Swagger is incorrectly parsing the JSON, when it should be posting the string
#10047
Open
jportner12 opened this issue
Jun 27, 2024
· 0 comments
openapi: 3.0.1info:
title: Swagger Petstore - OpenAPI 3.0description: |- This is a sample Pet Store Server based on the OpenAPI 3.0 specification. You can find out more about Swagger at [https://swagger.io](https://swagger.io). In the third iteration of the pet store, we've switched to the design first approach! You can now help us improve the API whether it's by making changes to the definition itself or to the code. That way, with time, we can improve the API in general, and expose some of the new features in OAS3. _If you're looking for the Swagger 2.0/OAS 2.0 version of Petstore, then click [here](https://editor.swagger.io/?url=https://petstore.swagger.io/v2/swagger.yaml). Alternatively, you can load via the `Edit > Load Petstore OAS 2.0` menu option!_ Some useful links: - [The Pet Store repository](https://github.com/swagger-api/swagger-petstore) - [The source API definition for the Pet Store](https://github.com/swagger-api/swagger-petstore/blob/master/src/main/resources/openapi.yaml)termsOfService: http://swagger.io/terms/contact:
email: apiteam@swagger.iolicense:
name: Apache 2.0url: http://www.apache.org/licenses/LICENSE-2.0.htmlversion: 1.0.11externalDocs:
description: Find out more about Swaggerurl: http://swagger.ioservers:
- url: https://petstore3.swagger.io/api/v3tags:
- name: testdescription: TestingexternalDocs:
description: Find out moreurl: http://swagger.iopaths:
/test:
post:
requestBody:
content:
application/x-www-form-urlencoded:
encoding:
params:
style: formschema:
properties:
params:
type: stringtype: objectresponses:
400:
description: Bad Requestcomponents:
schemas:
ApiResponse:
type: objectproperties:
code:
type: integerformat: int32type:
type: stringmessage:
type: stringxml:
name: '##default'securitySchemes:
petstore_auth:
type: oauth2flows:
implicit:
authorizationUrl: https://petstore3.swagger.io/oauth/authorizescopes:
write:pets: modify pets in your accountread:pets: read your petsapi_key:
type: apiKeyname: api_keyin: header
Describe the bug you're encountering
To reproduce...
Steps to reproduce the behavior:
Setup swagger editor page with above definition
Open "POST /test"
Hit "Try it out"
For params parameter, put in some json string ex: {"user": "Testing"}
In chrome dev tools, see that the request payload was user: Testing
On our upgrade from Swashbuckle.AspNetCore 6.5.0 to 6.6.2, they updated from swagger-ui-dist 4.15.5 to 5.17.10. This is working fine with swagger-ui-dist 4.15.5. But now appears to have been broken in 5.17.10.
The text was updated successfully, but these errors were encountered:
Q&A (please complete the following information)
Content & configuration
I replicated this bug on https://editor.swagger.io/ by using the below swagger definition.
Example Swagger/OpenAPI definition:
Describe the bug you're encountering
To reproduce...
Steps to reproduce the behavior:
{"user": "Testing"}
user: Testing
Expected behavior
HTTP request payload should be:
params: {"user": "Testing"}
Curl should be
Screenshots
Additional context or thoughts
On our upgrade from Swashbuckle.AspNetCore 6.5.0 to 6.6.2, they updated from swagger-ui-dist 4.15.5 to 5.17.10. This is working fine with swagger-ui-dist 4.15.5. But now appears to have been broken in 5.17.10.
The text was updated successfully, but these errors were encountered: