swagger-api/swagger-ui

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

Open

#5,872 opened on 2020年2月21日

GitHub で見る
 (0 comments) (0 reactions) (0 assignees)JavaScript (8,801 forks)batch import
Hacktoberfesttype: bug

Repository metrics

Stars
 (25,447 stars)
PR merge metrics
 (平均マージ 20h 34m) (30d で 14 merged PRs)

説明

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.

コントリビューターガイド