Skip to content

Latest commit

 

History

History
135 lines (96 loc) · 2.98 KB

README.md

File metadata and controls

135 lines (96 loc) · 2.98 KB

hikaku - Micronaut

Supports Micronaut 3.7.X

Feature Support

Please refer to the list of all features. To check the feature support for this converter.

Paths

  • Supports Controller annotation combined with empty HttpMethod annotation
    • Example:
@Controller("/todos")
class TodosController {

    @Get
    fun todos() { }
}
  • Supports Controller annotation combined with HttpMethod annotation
    • Example:
@Controller("/todo")
class TodosController {

    @Get("/list")
    fun todos() { }
}
  • Supports alias uri for HttpMethod annotation

    • Example: @Get(uri = "/todos")
  • Supports paths with leading and non-leading slash on both Controller and HttpMethod annotation

    • Examples:
      • @Controller("/todos") and @Controller("todos")
      • @Get("/todos") and @Get("todos")

Path parameters

  • Supports path parameter without annotation
    • Examples:
@Controller("/todos/{id}")
class TodosController {

    @Get
    fun todos(id: String) { }
}
  • Supports path parameter with annotation
    • Examples:
@Controller("/todos/{id}")
class TodosController {

    @Get
    fun todos(@PathVariable("id") otherName: String) { }
}
  • Supports using alias name
    • Examples: @PathVariable(name = "id") otherName: String

Query parameters

  • Supports query parameter without annotation
    • Examples:
@Controller("/todos")
class TodosController {

    @Get
    fun todos(filter: String) { }
}
  • Supports query parameter with annotation
    • Examples:
@Controller("/todos")
class TodosController {

    @Get
    fun todos(@QueryValue("filter") filter: String) { }
}
  • Supports setting the parameter required or optional based on the existence of a default value
    • Examples: @QueryValue("filter", defaultValue = "all") filter: String

Header parameters

  • Supports required header parameter
    • Examples:
@Controller("/todos")
class TodosController {

    @Get
    fun todos(@Header("allow-cache") otherName: String) { }
}
  • Supports optional header parameter based on the existence of a default value
    • Examples: @Header("allow-cache", defaultValue = "true") otherName: String

Consumes

  • Supports default media type application/json

  • Supports single and multiple media type declarations in Controller annotation

  • Supports Consumes annotation with single and multiple media type declarations on class and function

  • Supports Consumes annotation overriding the value of the Controller annotation

Produces

  • Supports default media type application/json

  • Supports single and multiple media type declarations in Controller annotation

  • Supports Produces annotation with single and multiple media type declarations on class and function

  • Supports Produces annotation overriding the value of the Controller annotation

Usage

Instantiate the converter with a package name which will be scanned recursively for controllers.

Example: MicronautConverter("io.github.ccjhr.hikaku")