Giter Club home page Giter Club logo

Comments (7)

zachdaniel avatar zachdaniel commented on June 30, 2024

I think a new verb would work well, specifically a read_one to contrast a get. get uses an identity whereas read_one simply expects the query to return one result (using Api.read_one/2)

from ash_graphql.

zachdaniel avatar zachdaniel commented on June 30, 2024

I'll leave a note here shortly with some implementation tips, would be very grateful to have you PR it.

from ash_graphql.

zachdaniel avatar zachdaniel commented on June 30, 2024

So step 1 will be to add an entity to the DSL. You can model it off of get, but it just won't take an identity option.

https://github.com/ash-project/ash_graphql/blob/master/lib/resource/resource.ex#L7

You'll need to add code to determine the query type: (same as get)

https://github.com/ash-project/ash_graphql/blob/master/lib/resource/resource.ex#L562

You'll need to configure it to accept the read_args, but not the identity like get does:

https://github.com/ash-project/ash_graphql/blob/master/lib/resource/resource.ex#L580

And then you'll need to add a resolver for :read_one:

https://github.com/ash-project/ash_graphql/blob/master/lib/graphql/resolver.ex#L6

I think that should be it.

from ash_graphql.

michaelst avatar michaelst commented on June 30, 2024

#13 not sure if there is any testing or other documentation you would want me to add on this

from ash_graphql.

zachdaniel avatar zachdaniel commented on June 30, 2024

If you could add a test in read_test.exs that would be great :D

from ash_graphql.

michaelst avatar michaelst commented on June 30, 2024

test added

from ash_graphql.

zachdaniel avatar zachdaniel commented on June 30, 2024

Released in 0.14.0

from ash_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.