Skip to content

Feature: Please detect ModelAndView as text/html content #428

Closed
@coding-jj

Description

@coding-jj

Is your feature request related to a problem? Please describe.

  • No OpenApi Endpoint is rendered for return type org.springframework.web.servlet.ModelAndView (see example at the end)

Describe the solution you'd like

  • springdoc-openapi should detect ModelAndView
  • Return OpenApi Document like (mind the "type": "string"):
"responses": {
  "200": {
    "description": "default response",
    "content": {
      "text/html": {
        "schema": {
          "type": "string"
        }
      }
    }
  }
}

Describe alternatives you've considered

Workaround return Object. But this will not produce a correct return type.

@Operation(summary = "Get Status")
@GetMapping(value = "/status", produces = MediaType.TEXT_HTML_VALUE)
public Object getStatus()

OpenApi Response should be "type": "string"

"responses": {
  "200": {
    "description": "default response",
    "content": {
      "text/html": {
        "schema": {
          "type": "object"
        }
      }
    }
  }
}

Additional context

Example:

@Operation(summary = "Get Status")
@GetMapping(value = "/status", produces = MediaType.TEXT_HTML_VALUE)
public ModelAndView getStatus()

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions