'How to display object properties as separate fields in Swagger UI?

I am writing API documentation using OpenAPI 3.0. At the moment I have:

paths:
  /script/update:
    post:
      tags: 
      - "Script"
      summary: Update a script
      operationId: updateScript
      responses:
        '200':
          description: OK
        "404":
          description: Not Found
      requestBody:
        description: A script object in order to make the request
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                subsite_id:
                  type: string
                script:
                  type: object
                  properties:
                    script:
                      $ref: '#/components/schemas/ScriptType'
                    type:
                      type: string
                      enum:
                        - custom
                        - interface
                        - freshbot
                        - feeder
                        - getter
                        - smcf
                    status:
                      $ref: '#/components/schemas/ScriptStatus'
                    comment:
                      type: string
                      format: string
                    reason:
                      type: string
                      format: string

To problem comes when I try to use to Swagger UI. The only thing that appears is the following: enter image description here What I want is that the script object can be filled out field by field for each of the properties it has, like the subsite_id. What am I missing?



Solution 1:[1]

Swagger UI 3.x and 4.x do not have a form editor for JSON objects, so all JSON data needs to be entered in the JSON format: { "prop": value, ... }

Here's the corresponding feature request you can track:
https://github.com/swagger-api/swagger-ui/issues/2771

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1