You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using quarkus and would like to edit the schema so I tried using a function like public GraphQLSchema.Builder editSchema(@Observes GraphQLSchema.Builder builder) but as far as I understand I can only add things to the builder, I can not edit the schema.
The System.out.println(node); gets executed but the schema at url/q/dev-ui/io.quarkus.quarkus-smallrye-graphql/graphql-schema doesn't change.
Am I missing something ? Is this even possible ?
Here's the reproducer https://github.com/Pilpin/quarkus-graphql-schema-bug
In it I'm trying to add a field to the country object, and the logs seem to show that it works, up until the observing function returns.
So the implementation is indeed wrong and I think we will have to step away from using CDI events, and rework it to do something else... Unless CDI events allow you to somehow access the objects returned from observers, which I think they don't.
Thinking what would be the least intrusive way to fix this...
We could change the signature of the beforeSchemaBuild method to void beforeSchemaBuild(SchemaBuilderHolder holder)
or add this as a new variant to maintain backward compatibility
You would then change it via
void updateSchema(@Observes SchemaBuilderHolder holder) {
GraphQLSchema.Builder newBuilder = holder.getSchemaBuilder() .... // and some transformations here
holder.setSchemaBuilder(newBuilder);
}
The SchemaBuilderHolder would be a wrapper that only contains a reference to GraphQLSchema.Builder, so when the event observer changes that reference, the container would be able to receive the "new" builder instance from there.
It's ugly but it could work.
Any better ideas?
Hello,
I'm using quarkus and would like to edit the schema so I tried using a function like
public GraphQLSchema.Builder editSchema(@Observes GraphQLSchema.Builder builder)
but as far as I understand I can only add things to the builder, I can not edit the schema.I tried something like this
The
System.out.println(node);
gets executed but the schema at url/q/dev-ui/io.quarkus.quarkus-smallrye-graphql/graphql-schema doesn't change.Am I missing something ? Is this even possible ?
Here's the reproducer https://github.com/Pilpin/quarkus-graphql-schema-bug
In it I'm trying to add a field to the country object, and the logs seem to show that it works, up until the observing function returns.
First asked about this on quakus' discussions quarkusio/quarkus#34733
Thanks.
The text was updated successfully, but these errors were encountered: