graphql-zeus icon indicating copy to clipboard operation
graphql-zeus copied to clipboard

Add * field

Open aexol opened this issue 5 years ago • 2 comments

Add * field to construct a query with all scalar and enum fields.

enum Kind{
   FISH
   BIRD
}
type Animal{
  name: String!
  friends: [Animal!]!
  age: Int!
  kind: Kind!
}
type Query{
  animals: [Animal!]!
}
schema{
  query: Query
}
Gql.query({
  animals:{
    '*': true
  }
})

should result in

{
  animals{
    name
    age
    kind
  }
}

aexol avatar Oct 27 '20 23:10 aexol

Is there a runtime way to just grab all the fields that a particular query path may have? That way you could introduce mixins as well, like an Omit(Queries.animal, ['age']).

stewartmcgown avatar Feb 02 '21 11:02 stewartmcgown

I suggest api similar to genql's one:

import { everything } from "./zeus-graphql"

Gql.query({
  animals:{
    ...everything,
    age: false,
  }
})

elderapo avatar May 30 '21 23:05 elderapo