Wire @DgsDirective in orderly #1849
khacsinhcs
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
What order are you expecting these in? It shouldn't technically matter for
what we are doing here, so curious to learn more about your use case.
…On Tue, Mar 19, 2024 at 2:00 AM Khac Sinh ***@***.***> wrote:
private fun findDirectives(applicationContext: ApplicationContext, runtimeWiringBuilder: RuntimeWiring.Builder) {
applicationContext.getBeansWithAnnotation<DgsDirective>().values.forEach { directiveComponent ->
val annotation = AopUtils.getTargetClass(directiveComponent).getAnnotation(DgsDirective::class.java)
when (directiveComponent) {
is SchemaDirectiveWiring ->
if (annotation.name.isNotBlank()) {
runtimeWiringBuilder.directive(annotation.name, directiveComponent)
} else {
runtimeWiringBuilder.directiveWiring(directiveComponent)
}
else -> throw RuntimeException("Invalid @DgsDirective type: the class must implement graphql.schema.idl.SchemaDirectiveWiring")
}
}
}
DGS currently strategy to wire SchemaDirectiveWiring is not keep the
order. In my case, I need to wire my custom annotation in order. Can we
sort by @order <https://github.com/order> provide by Spring
—
Reply to this email directly, view it on GitHub
<#1849>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJ5JPXKSWOLJI7VEHQWET5TYY75EFAVCNFSM6AAAAABE5DUPFSVHI2DSMVQWIX3LMV43ERDJONRXK43TNFXW4OZWGM4TIMRVGI>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
DGS currently strategy to wire SchemaDirectiveWiring is not keep the order. In my case, I need to wire my custom annotation in order. Can we sort by @order provide by Spring
Beta Was this translation helpful? Give feedback.
All reactions