springfoxspringdocspringdoc-openapi-ui

Replace paramType in SpringFox


I have this @ApiImplicitParam annotation used by SpringFox to document endpoint. I want to migrate to springdoc.

  @ApiImplicitParam(name = "Proxy", value = "Authorization value", required = true, dataType = "string", paramType = "header")
  public .. endpoint(...){
     .....
  }

I replaced it to this:

  @Parameter(name = "Proxy", description = "Authorization value", required = true, dataType = "string", paramType = "header")
  public .. endpoint(...){
     .....
  }

But I get Cannot resolve method 'dataType' and Cannot resolve method 'paramType'. Do you know what should be the proper replacement for these values in springdoc?


Solution

  • As you found, dataType isn't supported. Instead we have content, schema, and array (for array elements) fields. It can be used in either of the below ways

    I've not tried the first one personally and in fact is the first time I saw it. (Maybe it was introduced in Springdoc 2.x?) But it seems to be cleaner way compared to the second.