a couple questions about new compiler plugins APIs...
# apollo-kotlin
a
a couple questions about new compiler plugins APIs. ill split into two different message: for
registerOperations
the function is synchronous but description is :
Copy code
* Send operations to a remote server and return the server persisted ids
does the method allow for blocking API calls, or designed for it? seems like it could be a suspend function instead.
m
You can block. This is called from a task action/worker. It's on Gradle to parallelize
a
awesome! we have our own registration endpoint that uses operation manifests too, but we use a wrapper + convention plugin on top of apollo to create our own registration tasks. i wonder if i can hook into native apollo gradle tasks to do it instead. this would be a nice addition to try out!
m
The problem IIRC (on mobile right now so I don't have all the details) is that registration is made inside the codegen task itself. We could change that but then it means users have to deal with Gradle task wiring. Which is good for your use case but more involved for others.
Also means there's a small price to pay to serialize the ids, etc.... I'm a bit concerned that as we split the tasks, we're introducing small overhead every time that could add up eventually
What would you get from having the registration in your own task vs a plugin?
a
previously plugin wasnt possible i think? into the apollo 3 code. well it is a custom task within our own gradle plugin that wraps the apollo one. i think the benefit of consistent usage of gradle tasks. i guess it seems: https://www.apollographql.com/docs/kotlin/advanced/persisted-queries/#2-publish-operation-manifest is not the same as
pushApolloSchema
?
m
Oh those are 2 different things: •
registerOperations
is to upload operations (not GraphOS specific) •
pushApolloSchema
is to upload a schema (GraphOS specific)
I don't think we have a Gradle task for
rover persisted-queries publish
but that'd be nice to have indeed
1
a
🤯
Copy code
registerOperations is to upload operations (not GraphOS specific)
but not to publish persisted queries / operation manifests? ha i think im confused due to our task being called
wgqlRegister
that does this
m
Damn, sorry I got confused myself
Looks like the docs are out of date 😒
Oh no it's good sorry
registerOperation
is not part of the plugin API
It's something you have to implement
What we need is a default implementation that does it for GraphOS
Curious how you're doing this with apollo 3. Theorically, it shuold be done with
OperationIdGenerator/OperationOutputGenerator
In all cases, feel free to open an issue about this
Was doing some digging, turns out we have it already 🙂
🦜 1
The only difference with the rover one is that the rover one is able to automatically get a
listId
from a graph ref