Code Monkey home page Code Monkey logo

Comments (9)

mickhansen avatar mickhansen commented on July 22, 2024

Hmm, i wasn't actually aware that you would need to return fields other than those requested.
But in any case i have been considering whether we should remove attribute filtering at all or just fetch them all (since it continues to cause small subtle bugs).

from graphql-sequelize.

idris avatar idris commented on July 22, 2024

Yeah I may have misdiagnosed this. Taking a look now

On Tue, Oct 20, 2015 at 9:18 AM Mick Hansen [email protected]
wrote:

Hmm, i wasn't actually aware that you would need to return fields other
than those requested.
But in any case i have been considering whether we should remove attribute
filtering at all or just fetch them all (since it continues to cause small
subtle bugs).


Reply to this email directly or view it on GitHub
#45 (comment)
.

from graphql-sequelize.

idris avatar idris commented on July 22, 2024

Okay the real problem is that the map option is only on attributeFields, not on the resolver. So anything you map doesn't actually get resolved unless you manually specify a resolver.

I think we should either get rid of the map option, or somehow make resolver aware of mapped fields. The problem is, I don't see a good way to get that map object shared between the two without having to specify it in both places, which is not great.

from graphql-sequelize.

idris avatar idris commented on July 22, 2024

Gah.. my brain wasn't working properly.. This is very simple.. just need to add a resolver in attributeFields. I'll work on a pull request now.

from graphql-sequelize.

mickhansen avatar mickhansen commented on July 22, 2024

Ah yeah, mapped attributes will need a resolver or a virtual field (but with a virtual we don't really need map).

from graphql-sequelize.

idris avatar idris commented on July 22, 2024

See this branch for the problem (with failing test): master...idris:mapped-fields

Even after adding a resolver to the field, the field is never included in findOptions.attributes, so it never gets queried for. I can't think of a way to get the actual field name in resolver.js so we can automatically include mapped fields.

If we can't think of a solution for this, I think we should just get rid of the map functionality altogether, to avoid confusion. It's easy enough to do it manually.

from graphql-sequelize.

mickhansen avatar mickhansen commented on July 22, 2024

Or we disable findOptions.attributes filtering, it keeps giving me headaches.

from graphql-sequelize.

idris avatar idris commented on July 22, 2024

I think you at least want the attributes filtering in case there are large fields, like binary or JSONB fields that the user is never going to use.

map could also cause confusion and problems in the future. For example, if you try to map an associated field.

from graphql-sequelize.

mickhansen avatar mickhansen commented on July 22, 2024

Alright since you requested the feature initially i'll kill it for now.

from graphql-sequelize.

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.