Skip to content

@RequestAttribute parameter appears in the UI #267

Closed
@derlin

Description

@derlin

Context

I have a filter that adds attributes to the HTTP requests that are derived from headers and other things. In my controllers, I have endpoints that uses these attributes, like this:

@GetMapping("/{id}")
fun getById(
    @PathVariable(value = "id") id: Long,
    @RequestAttribute(value = "userid") userId: Int, /* <= set in a filter */
    @RequestParam(name = "writable", required = false) writable: Boolean = false
) { /* ... */ }

The generated UI is:

Screenshot 2019-12-14 at 17 47 17

Problem

I expect the @RequestAttribute to be ignored by OpenAPI, since it is an internal attribute that the client ignores. But it is still present in the interface (which is misleading) and marked as required (so the user cannot use try it out).

Questions

  1. Is this a normal behavior ?
  2. How can I mark a method parameter as hidden (and if possible globally, since the same attribute is used in many places) ?

versions

  • org.springframework.boot => 2.2.1.RELEASE
  • org.springdoc:springdoc-openapi-ui => 1.2.17

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