Skip to content

Latest commit

 

History

History
155 lines (98 loc) · 5.82 KB

README.md

File metadata and controls

155 lines (98 loc) · 5.82 KB

hikaku - Spring

Supports Spring MVC 5.3.X.

Feature Support

Please refer to the list of all features. To check the feature support for this converter. You will find a list of spring specific features that are supported below.

Paths

  • Supports RequestMapping annotation

    • Example: @RequestMapping("/todos")
  • Supports all HTTP method based mapping annotations (DeleteMapping, GetMapping, PatchMapping, PostMapping, PutMapping)

    • Example: @GetMapping("/todos")
  • Supports endpoint definition on class level, method level and a combination of both.

  • Supports multiple path definitions on all HTTP method based mapping annotations

    • Example: @GetMapping(value = ["/todos", "todo/list"])
  • Supports multiple path definitions on RequestMapping annotation

    • Example: @RequestMapping(value = ["/todos", "todo/list"], method = [RequestMethod.POST, RequestMethod.GET])
  • Supports endpoints using regex for path parameter

    • Example: @RequestMapping("/{id:[0-9]+}")

HTTP method

  • Supports RequestMapping annotation

    • Example: @RequestMapping(method = GET)
  • Supports all HTTP method based mapping annotations (DeleteMapping, GetMapping, PatchMapping, PostMapping, PutMapping)

    • Example: @GetMapping("/todos")

Query parameters

  • Supports parameter name using variable name

    • Example: @RequestParam tag: String
  • Supports parameter name defined by 'value'

    • Example: @RequestParam(value = "tag") otherName: String
  • Supports parameter name defined by alias 'name'

    • Example: @RequestParam(name = "tag") otherName: String
  • Throws an exception in case both 'value' and 'name' are set.

    • Example: @RequestParam(value = "param", name = "other") foo: String
  • Checks if a parameter is required depending on the value of the 'required' attribute

    • Example: @RequestParam(required = false) foo: String
  • Checks if a parameter is required depending on the existence of the 'defaultValue' attribute

    • Example: @RequestParam(value = "tag", defaultValue = "all")

Path parameters

  • Supports parameter name using variable name

    • Example: @PathVariable id: Int
  • Supports parameter name defined by 'value'

    • Example: @PathVariable(value = "id") otherName: Int
  • Supports parameter name defined by alias 'name'

    • Example: @PathVariable(name = "id") otherName: Int
  • Throws an exception in case both 'value' and 'name' are set.

    • Example: @PathVariable(value = "param", name = "other") foo: Int

Header parameters

  • Supports parameter name using variable name

    • Example: @RequestHeader allowCache: String
  • Supports parameter name defined by 'value'

    • Example: @RequestParam(value = "allow-cache") otherName: String
  • Supports parameter name defined by alias 'name'

    • Example: @RequestHeader(name = "allow-cache") otherName: String
  • Throws an exception in case both 'value' and 'name' are set.

    • Example: @RequestHeader(value = "param", name = "other") foo: String
  • Checks if a parameter is required depending on the value of the 'required' attribute

    • Example: @RequestHeader(required = false) foo: String
  • Checks if a parameter is required depending on the existence of the 'defaultValue' attribute

    • Example: @RequestHeader(value = "tracker-id", defaultValue = "2394")

Matrix parameters

  • Supports parameter name using variable name

    • Example: @MatrixVariable tag: String
  • Supports parameter name defined by 'value'

    • Example: @MatrixVariable(value = "tag") otherName: String
  • Supports parameter name defined by alias 'name'

    • Example: @MatrixVariable(name = "tag") otherName: String
  • Throws an exception in case both 'value' and 'name' are set.

    • Example: @MatrixVariable(value = "param", name = "other") foo: String
  • Checks if a parameter is required depending on the value of the 'required' attribute

    • Example: @MatrixVariable(required = false) foo: String
  • Checks if a parameter is required depending on the existence of the 'defaultValue' attribute

    • Example: @MatrixVariable(value = "tag", defaultValue = "shopping")

Produces

  • Supports RequestMapping annotation

    • Example: @RequestMapping(produces = "text/plain")
  • Supports all HTTP method based mapping annotations (DeleteMapping, GetMapping, PatchMapping, PostMapping, PutMapping)

    • Example: @GetMapping(produces = "text/plain")
  • Supports javax.servlet.http.HttpServletResponse parameter type

    • Example: @GetMapping("/items") fun getItems(response: HttpServletResponse)
  • Supports default value in case no produces definition has been set

  • Supports text/plain if the return value is a String and no produces definition has been set

Consumes

  • Supports RequestMapping annotation

    • Example: @RequestMapping(consumes = "text/plain")
  • Supports all HTTP method based mapping annotations (DeleteMapping, GetMapping, PatchMapping, PostMapping, PutMapping)

    • Example: @GetMapping(consumes = "text/plain")
  • Supports default value in case no consumes definition has been set

  • Supports */* if the return value is a String and no consumes definition has been set

Currently not supported

  • Checking whether or not to explode query parameter.

    • Example: @RequestParam(value="tag", required=false) tags: List<String> or @RequestParam(value="tag", required=false) tags: Array<String>
  • Query Parameter based on an object

    • Example: @GetMapping("/todos") fun getAllTodos(queryParams: MyObject)
  • Parameter annotations on a HashMap to dynamically extract parameters

  • Matrix parameters having a binding to a specific path element

    • Example: @MatrixVariable(pathVar = "employee")
  • Produces using negated media type

    • Example: @RequestParam(produces = "!text/plain")
  • Consumes using negated media type

    • Example: @RequestParam(produces = "!text/plain")