Git Product home page Git Product logo

Comments (10)

LiLatee avatar LiLatee commented on July 30, 2024 1

Ok, I think I found a solution with the use typeOverrides map, but I need to check it. I will back to you

from ferry.

knaeckeKami avatar knaeckeKami commented on July 30, 2024

Do you also have multiple operations in the same file in your larger project?

from ferry.

thomas7D avatar thomas7D commented on July 30, 2024

Yes, I group related queries and mutations for the same objects in a single file.

from ferry.

knaeckeKami avatar knaeckeKami commented on July 30, 2024

Thanks! can you reproduce this issue when you put all operations in a separate file?

from ferry.

thomas7D avatar thomas7D commented on July 30, 2024

No, code is fine when I put the mutation in a separate graphql file.

I tested different variations of putting operations in single files, grouping them slightly, etc. and stumbled on this:

If I put both operations in the same file like this, I get the wrong imports prefixes:

query Pokemons {
    pokemons {
        id
        name
    }
}

mutation UpdatePokemon($id: ID!, $name: String) {
    updatePokemon(id: $id, name: $name) {
        id
        name
    }
}

If I switch them around and rerun build_runner, I get no errors in the generated files:

mutation UpdatePokemon($id: ID!, $name: String) {
    updatePokemon(id: $id, name: $name) {
        id
        name
    }
}

query Pokemons {
    pokemons {
        id
        name
    }
}

So I don't think it's related to grouping them or spreading them into separate files.

from ferry.

LiLatee avatar LiLatee commented on July 30, 2024

The first problem is here:
image
because of that typeDefNode is always null and then isBuilder is true and it uses replace instead of the value assignment operator (=).
image

And even if originalSymbolName would be fine, in the case of CustomDate it still won't work, because the name of the Node is Date (so the name of the Scalar, not the custom class we've created)
image
Unfortunately, I cannot find any simple way to overcome it for now 🤔
@knaeckeKami any tips?

from ferry.

LiLatee avatar LiLatee commented on July 30, 2024

Hm I am a little bit blocked.
I think the problem is that during generating schema.schema.gql.dart file it uses 2 different allocators for input classes and input serializer classes.
I also think that the error is inside ferry_generator package, because generating the code with the use of clean gql_builder works fine and it only breaks when using ferry_generator.
But unfortunately, I am not so familiar with that code and cannot spot the error 🤔

from ferry.

knaeckeKami avatar knaeckeKami commented on July 30, 2024

Ok, no worries, I'll take a look at it.
I also think it's related to the Allocators.

from ferry.

LiLatee avatar LiLatee commented on July 30, 2024

I think I found it 😃 I can create PR soon 👌

from ferry.

LiLatee avatar LiLatee commented on July 30, 2024

Here is the fix #583 for the aforementioned issue (Test fails 😞 )
and another fix is here gql-dart/gql#448

from ferry.

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.