Skip to content

Request Body for Maps not available in Swagger-UI #597

Closed
@mburri

Description

@mburri

Describe the bug

Given a ressource that excpects a request body of the following type:
@RequestBody HashMap<String, String> body

The Request Body is not available in the Swagger-UI for the resource since springdoc-openapi-ui 1.3.1
But it works in springdoc-openapi-ui 1.3.0

To Reproduce
Steps to reproduce the behavior:

  • What version of spring-boot you are using?
    Spring Boot 2.2.6

  • What modules and versions of springdoc-openapi are you using?
    1.3.1 (also tested with 1.3.4 - same issue)

  • What is the actual and the expected result using OpenAPI Description (yml or json)?

the requestbody is not available in the UI - but it should be. The generated api docs is the same for springdoc-openapi-ui 1.3.0 and 1.3.1

  • Provide with a sample code (HelloController) or Test that reproduces the problem
    @PostMapping
    public ResponseEntity<HashMap<String, Object>> hello(@RequestBody HashMap<String, Object> map) {
        return ResponseEntity.ok(map);
    }

Expected behavior

  • A clear and concise description of what you expected to happen.

When trying out the API in Swagger UI - I should be able to pass in the request body.

Screenshots

This is a screenshot of the resource in Swagger-UI with springdoc-openapi-ui v1.3.0:
Request Body available (Version 1.3.0)

This is a screenshot of the resource in Swagger-UI with springdoc-openapi-ui v1.3.1 and above:
Missing Request Body with Version 1.3.1 and above
The section for the request body is missing...
Additional context
none

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions