swagger-ui: Requestbody x-www-form-urlencoded is not properly rendered

Q&A (please complete the following information)

  • OS: windows
  • Browser: chrome
  • Version: 67
  • Method of installation: dist
  • Swagger-UI version: 3.17.0
  • Swagger/OpenAPI version: OpenAPI 3.0

Content & configuration

Swagger/OpenAPI definition:

     requestBody:
       description: user info to be filled
       content:
         application/x-www-form-urlencoded:
           schema:
             type: object
             required:
               - username
               - name
             properties:
               username:
                 type: string
                 description: user identity
               name:
                 type: string
                 description: user name
               phone_number:
                 type: string
                 pattern: '/\d{11}/'
                 description: phone number

_20180613215633 Swagger-UI configuration options:

SwaggerUI({
  // your config options here
})
?yourQueryStringConfig

Is your feature request related to a problem?

  • property descriptions are not shown
  • required properties are not starred
  • required properties checking, string regex pattern checking is not performed when try swagger client

However, parameters are ideally shown. There should be no much difference between parameters and body form data.

Describe the solution you’d like

Describe alternatives you’ve considered

Additional context

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 3
  • Comments: 21 (7 by maintainers)

Most upvoted comments

This has been prioritized, and will be fixed shortly 😄

Works great now. Thanks a lot!

@shockey, not yet. I saw the release notes, and plan to upgrade to the latest. Thank you.

@arlix85 In OpenAPI 3.0, required is not suitable for properties, there’s a required array for properties, like

         type: object
              required:
                  - userid
              properties:
                userid:
                  type: string
                  description: the id (or email address) inserted by the user in the login form
                  example: test

Thanks.

Hello, I was about to open a new issue but I’ve seen this one which is correlated. I would like to integrate Ispvic report with the object-level “example” (as documented here https://swagger.io/docs/specification/adding-examples/#request-response-bodies) which doesn’t seem to be supported:

         application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                userid:
                  type: string
                  description: the id (or email address) inserted by the user in the login form
                password:
                  type: string
                  format: password
              example:
                userid: test
                password: password

Plus, the example is still populated by using the notation inside the properties…

              properties:
                userid:
                  type: string
                  description: the id (or email address) inserted by the user in the login form
                  example: test

…but in the form the example is always rendered between quotation marks: screenshot-gimme5 acomea prv-2018 06 14-12-25-56

If something is wrong on my YAML code, please let me know, I wasn’t able to correct the issue even with different notations.

Thanks, Fabio