Skip to content

injected HttpHeaders class interpreted as schema object #3317

Description

@icguy

Describe the bug

I have a controller method with a similar signature:

@RestController
class MyController {

    @GetMapping("api/foo")
    fun getFoo(
        ...
        @RequestHeader headers: org.springframework.http.HttpHeaders // access all headers
    ): Unit {
        if(headers.range.isNotEmpty()) { ... }
    }
}

The Spring Boot class HttpHeaders is interpreted as a regular DTO and is included in the openapi yaml output as such:

{
  "openapi": "3.1.0",
  "info": {
    "title": "OpenAPI definition",
    "version": "v0"
  },
  ...
  "components": {
    "schemas": {
      ...
      "HttpHeaders": {
        "type": "object",
        "properties": {
          "empty": {
            "type": "boolean"
          },
          "location": {
            "type": "string",
            "format": "uri"
          },
          "host": {
            "type": "object",
            "properties": {
              "address": {
                "type": "object",
                "properties": {
                  "address": {
                    "type": "string",
                    "format": "byte"
                  },
                  ...

To Reproduce
Steps to reproduce the behavior:

  • What version of spring-boot you are using?
    • 4.0.6
  • What modules and versions of springdoc-openapi are you using?
    • org.springdoc:springdoc-openapi-starter-webmvc-ui:3.0.3

Expected behavior

Unclear, the current behavior is most likely not preferable. Since the intention of the author of the controller cannot be inferred I would expect the parameter to be omitted from the openapi yml docs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions