GithubHelp home page GithubHelp logo

Comments (8)

wax911 avatar wax911 commented on August 22, 2024 1

I think I found your problem, in provideApiService

    .addConverterFactory(GraphConverter.create(context, ILogger.Level.VERBOSE))
    .addConverterFactory(GsonConverterFactory.create(GsonBuilder().create()))

Swap the order of graph converter and gson converter, otherwise retrofit will default to the Gson and you should see more loggs

2021-04-01 12:02:32.146 9534-9534/com.letrix.miranime V/GraphProcessor: main: has obtained a synchronized lock on the object
2021-04-01 12:02:32.146 9534-9534/com.letrix.miranime V/GraphProcessor: main: is initializing query files
2021-04-01 12:02:32.154 9534-9534/com.letrix.miranime V/GraphProcessor: main: has completed initializing all graphql files
2021-04-01 12:02:32.154 9534-9534/com.letrix.miranime V/GraphProcessor: main: discovered `3` graphql files
2021-04-01 12:02:32.250 9534-9569/com.letrix.miranime D/GraphProcessor: Looking up `.graphql` file matching: GetHome.graphql

N.B GraphConverter has factory methods to initialise everything you need e.g. GraphConverter.create(context, ILogger.Level.VERBOSE)

If you need GsonConverterFactory for some other endpoints you could simply extend GraphConverter and override requestBodyConverter to provide a different converter for anything else that is not annotated with GraphQuery on the methodAnnotations

from retrofit-graphql.

LetrixZ avatar LetrixZ commented on August 22, 2024 1

It worked! Thanks :)

from retrofit-graphql.

wax911 avatar wax911 commented on August 22, 2024

Hi, are you sure that the .graphql file isn't being detected? Can you check the logcat as you make the request you should find the following output:

"The requested query annotated with value: `GetAnime` could not be found!"

If the file isn't found

from retrofit-graphql.

LetrixZ avatar LetrixZ commented on August 22, 2024

I wasn't getting any output, so I added this to my Retrofit builder:

addConverterFactory(GraphConverter(GraphProcessor(AssetManagerDiscoveryPlugin(assetManager = context.assets),logger = DefaultGraphLogger(ILogger.Level.VERBOSE)), Gson()))

Output:

V/GraphProcessor: main: has obtained a synchronized lock on the object
V/GraphProcessor: main: is initializing query files
V/GraphProcessor: main: has completed initializing all graphql files
V/GraphProcessor: main: discovered `1` graphql files

Running this I can get the first line of the file:

assets.open("GetAnime.graphql").bufferedReader().readLine()

from retrofit-graphql.

wax911 avatar wax911 commented on August 22, 2024

From the small snipet you have provided it looks like the file is found but at runtime somethings seems to be off, I have tried the sample project with the default converter: GraphConverter(...) just to be sure that the issue isn't coming from there and that seems to be working fine, can you please provide a full log filtered by GraphProcessor from the startup of your application to the point after you get the error Must provide query string

from retrofit-graphql.

LetrixZ avatar LetrixZ commented on August 22, 2024

I'm trying on another project and the same issue. This is all the logging I have and I only receive only those 4 lines from GraphProcessor.
MainActivity$onCreate is where I called it using CoroutineScope(Dispatchers.IO).launch
logcat.txt

from retrofit-graphql.

wax911 avatar wax911 commented on August 22, 2024

Just out of curiosity, what does your assets folder structure look like, and do you mind sharing your second demo sample so I can take a look?

from retrofit-graphql.

LetrixZ avatar LetrixZ commented on August 22, 2024

This is the project I'm working it right now: https://github.com/LetrixZ/miranime
assets folder
ApiService Interface
Retrofit Builder

In the meantime, I'm using Apollo without problems.

from retrofit-graphql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.