question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Swagger-ui 3.x no longer detects content type based on parameter

See original GitHub issue

In swagger-ui 2.x if there was a formData parameter Content-Type:application/x-www-form-urlencoded would be set automatically. Example: screen shot 2017-08-16 at 1 35 21 pm

With the new swagger-ui 3.x the ContentType isn’t changed based on the presence of a formData parameter and sticks with content-type:application/json

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:21 (15 by maintainers)

github_iconTop GitHub Comments

2reactions
webroncommented, Jul 6, 2018

Glad you got it working. We’ll give it a few more days before closing the issue.

1reaction
webroncommented, Jul 6, 2018

That’s because you’re defining the payload as json. If you change it to application/x-www-form-urlencoded it’ll behave differently.

openapi: 3.0.0
info:
 title: Blog API
 version: 0.1.0
components:
 responses:
   UnauthorizedError:
     description: API key is missing or invalid
paths:
 /addPost:
   post:
     requestBody:
       required: true
       content:
         application/x-www-form-urlencoded:
           schema:
             type: object
             properties:
               title:
                 type: string
               body:
                 type: string
             required:
               - title
               - body
     responses:
       '200':
         description: default response
         content:
           application/json:
             schema:
               type: object
               properties:
                 title:
                   type: boolean
Read more comments on GitHub >

github_iconTop Results From Across the Web

asp.net - Swagger UI doesn't render body parameter field for ...
I added a new Controller to my API. There is a GET action with a complex type parameter. For complex types, Web API...
Read more >
CORS - Swagger Documentation
This tells us that the petstore resource listing supports OPTIONS, and the following headers: Content-Type , api_key , Authorization . Try Swagger UI...
Read more >
F.A.Q - Springdoc-openapi
How can I disable/enable Swagger UI generation based on env variable? ... Note: Header parameters named Accept, Content-Type and ...
Read more >
Using OpenAPI and Swagger UI - Quarkus
License. All of this information (and more) can be included in your Java code by using appropriate OpenAPI annotations on a JAX-RS ...
Read more >
SwaggerHub On-Premise Release Notes - SmartBear Support
It is no longer required to enable the anyuid SCC on OpenShift. ... Updated Swagger UI to v. 4.0.4 and Swagger Editor to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found