ignite-rest-api
August 30, 2022 ยท View on GitHub
This module defines REST APIs that might be provided by Ignite 3. Also, common DTOs and error handlers are defined.
API definition
The API definition is a java interface annotated with micronaut @Controller
annotations and several swagger-annotations. All those annotations are
needed to generate a valid Open API spec from these interfaces.
ClusterManagementApi is an example of API definition.
Error handling
Ignite 3 implements the application/problem+json in all endpoints. That's why problem definition and common problem handling are defined in this module. Here is how it works:
IgniteExceptionis thrown in any Ignite component- REST Controller might not handle this exception
IgniteExceptionHandleris invoked by micronaut infrastructureIgniteExceptionHandlerhandlesIgniteExceptionand returns a validapplication/problem+json
Make sure that
IgniteExceptionHandlerhas been loaded into micronaut context otherwise this class won't be invoked.
If you want to implement your exception handler the best place to do it
is the module where you define the REST controller. Don't put your handlers in
ignite-rest-api unless it is needed for all REST endpoints.