templates.graphql.handlerYml.rocker.raw Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of light-graphql-4j-generator Show documentation
Show all versions of light-graphql-4j-generator Show documentation
light-graphql-4j code generator.
@import java.util.Map
@import java.util.List
@args (String serviceId, boolean prometheusMetrics, boolean useLightProxy)
# Handler middleware chain configuration
---
enabled: true
#------------------------------------------------------------------------------
# Support individual handler chains for each separate endpoint. It allows framework
# handlers like health check, server info to bypass majority of the middleware handlers
# and allows mixing multiple frameworks like OpenAPI and GraphQL in the same instance.
#
# handlers -- list of handlers to be used across chains in this microservice
# including the routing handlers for ALL endpoints
# -- format: fully qualified handler class name@@optional:given name
# chains -- allows forming of [1..N] chains, which could be wholly or
# used to form handler chains for each endpoint
# ex.: default chain below, reused partially across multiple endpoints
# paths -- list all the paths to be used for routing within the microservice
# ---- path: the URI for the endpoint (ex.: path: '/v1/pets')
# ---- method: the operation in use (ex.: 'post')
# ---- exec: handlers to be executed -- this element forms the list and
# the order of execution for the handlers
#
# IMPORTANT NOTES:
# - to avoid executing a handler, it has to be removed/commented out in the chain
# or change the enabled:boolean to false for a middleware handler configuration.
# - all handlers, routing handler included, are to be listed in the execution chain
# - for consistency, give a name to each handler; it is easier to refer to a name
# vs a fully qualified class name and is more elegant
# - you can list in chains the fully qualified handler class names, and avoid using the
# handlers element altogether
#------------------------------------------------------------------------------
handlers:
# Light-framework cross-cutting concerns implemented in the microservice
- com.networknt.exception.ExceptionHandler@@exception
@if(prometheusMetrics){ - com.networknt.metrics.prometheus.PrometheusHandler@@prometheus} else { - com.networknt.metrics.MetricsHandler@@metrics}
- com.networknt.traceability.TraceabilityHandler@@traceability
- com.networknt.correlation.CorrelationHandler@@correlation @if(!useLightProxy) {
- com.networknt.graphql.security.JwtVerifyHandler@@security
- com.networknt.graphql.validator.ValidatorHandler@@validator}
# Framework endpoint handlers
- com.networknt.health.HealthGetHandler@@health
- com.networknt.info.ServerInfoGetHandler@@info
# - com.networknt.metrics.prometheus.PrometheusGetHandler@@getprometheus
# GraphQL handlers
- com.networknt.graphql.router.handlers.GraphqlGetHandler@@get
- com.networknt.graphql.router.handlers.GraphqlPostHandler@@post
- com.networknt.graphql.router.handlers.GraphqlOptionsHandler@@options
# Business Handlers
chains:
default:
- exception
@if(prometheusMetrics){ - prometheus} else { - metrics}
- traceability
- correlation @if(!useLightProxy){
- security
- validator}
paths:
- path: '/graphql'
method: 'get'
exec:
- default
- get
- path: '/graphql'
method: 'post'
exec:
- default
- post
- path: '/graphql'
method: 'options'
exec:
- default
- options
- path: '/health/${server.serviceId:@serviceId}'
method: 'get'
exec:
- health
- path: '/server/info'
method: 'get'
exec:
- info
@if(prometheusMetrics){ - path: '/prometheus'
method: 'get'
exec:
- getprometheus
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy