radhikavm
radhikavm

Reputation: 39

Dynamically generate GraphQL schema

One of my application requires Graphql schema that can have fields added & resolved on the fly based on the data. for example need something like

type Data {
   email: [String]!
   col1 :[Int]!
   col2: [Int]!
 ...col3:


}

where col1 == nameOfColumnOne, col2=nameOfColumnTwo etc will & be added based on the data and possibly set on the fly.

I am kind of stuck on this and will appreciate some help on this one please.

Upvotes: 0

Views: 467

Answers (1)

deniscapp
deniscapp

Reputation: 820

Couldn't you just have a resolver columns that resolves a list of these columns that will grow over time? It makes more sense to me. I don't believe that you can achieve this modeling that you want.

you would have a type Column which defines what a column is supposed to be, and have:

type Data {
   email: [String]!
   columns: [Column]!
} 

Hope it helps you :)

Upvotes: 1

Related Questions