dataType and paramType in @ApilmplicitParam in Swagger2

@ApilmplicitParam(name = "id", value = "用户id", require = true, dataType = "Integer", paramType = "query")

dataType: Represents the request parameter type
paramType: Represents where the parameter should be placed in the request
Value range of paramType:

  • header: placed in the request header, request parameter acquisition @RequestHeader, such as X-MyHeader: Value
  • query: Used for request parameter splicing, request parameter acquisition @RequestParam, such as /users?role=admin
  • path: used for restful interface, request parameter acquisition: @PathVariable, such as /users/{id}
  • body : placed in the request body, request parameter acquisition: @RequestBody
  • form: form means FormData, which is actually very commonly used. Any field modified by @RequestParam annotation can be transmitted with FormData, which can be said to be more recommended than query, but swagger does not use form because swagger-ui.html cannot send formData yet

Guess you like

Origin blog.csdn.net/Ally441/article/details/108186321