.graphql file isn't being detected
See original GitHub issueI followed the Getting Started guide to try this but the only way to get a response is to pass a QueryContainer reading the .graphql file instead of passing the builder with the @GraphQuery annotation
I checked the demo app and it’s done the ‘same’ way the guide says. Tried moving GetMarketplaceListing.graphql to another dir and still worked. Renaming the file made stopped working.
This was tested on AVD API 30 and on a Redmi Note 5 Android 10.
NOT Working MainActivity:
val query = QueryContainerBuilder().putVariable("idMal", 40060)
val anime = apiService.get(query)
ApiService (interface):
@POST("/graphql")
@GraphQuery("GetAnime")
suspend fun get(@Body builder: QueryContainerBuilder): Response<GraphContainer<Data>>
Body is null and the errorBody is ‘Must provide query string’
Working MainActivity:
val query = QueryContainerBuilder().setQuery(assets.open("graphql/queries/GetAnime.graphql").bufferedReader().readText())
.putVariable("idMal", 40060).build()
val anime = apiService.get(query)
ApiService (interface):
@POST("/graphql")
suspend fun get(@Body builder: QueryContainer): Response<GraphContainer<Data>>
This way the request is done fine and I get the data that I want.
GetAnime.graphql
query GetAnime($idMal: Int) {
anime(idMal: $idMal) {
id
idMal
idAl
}
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
in path causes .graphql files not to be found #6174 - GitHub
If an & character is the a parent directory that codegen is running in it will produce the error Unable to find any...
Read more >schema.graphql file can't be found (node graphql-yoga)
You gave the path ./schema.graphql which makes node look for the file in the directory where you run it instead of the correct...
Read more >Apollo extension for VS Code - Apollo GraphQL Docs
The Apollo VS Code extension provides an all-in-one tooling experience for developing apps with Apollo. Using jump to definition on a fragment.
Read more >GraphQL Code Libraries, Tools and Services
A query language for your API — GraphQL provides a complete description of the data in your API, gives clients the power to...
Read more >Five Common Problems in GraphQL Apps (And How to Fix ...
Namely, you need one schema for your database, and another one for your GraphQL endpoint. Not only is it frustrating to have to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It worked! Thanks 😃
I think I found your problem, in
provideApiService
Swap the order of graph converter and gson converter, otherwise retrofit will default to the Gson and you should see more loggs
If you need
GsonConverterFactory
for some other endpoints you could simply extendGraphConverter
and overriderequestBodyConverter
to provide a different converter for anything else that is not annotated withGraphQuery
on themethodAnnotations