Skip to content

Request bodies with different schemas and content types within one operation don't update data entry correctly #5872

@keyz182

Description

@keyz182

Q&A (please complete the following information)

  • OS: Windows 10
  • Browser: Chrome
  • Version: 79.0.3945.130 (Official Build) (64-bit)
  • Method of installation: https://unpkg.com/swagger-ui-dist/
  • Swagger-UI version: 3.25.0
  • Swagger/OpenAPI version: OpenAPI 3

Content & configuration

Minimal Example - https://keyz182.github.io/swagger_ui_bug/
SwaggerUI Init - https://github.com/keyz182/swagger_ui_bug/blob/9503ca4b04e9319536392229be641df915fb606a/index.html#L41
OpenAPI Yaml - https://github.com/keyz182/swagger_ui_bug/blob/master/openapi.yaml

Describe the bug you're encountering

When changing between request body content types, non form based bodies get stuck on the last one to be selected.

To reproduce...

  • Open the example linked above
    01

  • Change the content type before clicking try, then change back, all works as expected.
    02

  • Click try
    03

  • Change content type - Note that it doesn't match the Yaml
    04

  • Change to a form type - works correctly
    05

  • Change to a non form type - works correctly
    06

  • Change to another non form type - not working correctly
    07

Expected behavior

The editable request body box should show the appropriate content.

Additional context or thoughts

We have different schemas for different content types to support JSON API, along with other types. JSON API requires a very specific body type.

May be related to #3448 as it can manifest in an apparently similar manner, though selecting XML first does actually show XML.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions