swagger-api/swagger-ui

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

Open

#5,872 创建于 2020年2月21日

在 GitHub 查看
 (0 评论) (0 反应) (0 负责人)JavaScript (8,801 fork)batch import
Hacktoberfesttype: bug

仓库指标

Star
 (25,447 star)
PR 合并指标
 (平均合并 20小时 34分钟) (30 天内合并 14 个 PR)

描述

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.

贡献者指南