I am just starting to explore GraphQL as an option for my API level analytic platform.
My user interface is mainly built from tables and diagrams. in most cases, the data is some database columns grouped by size.
I found the following article https://www.microsoft.com/developerblog/2017/09/28/data-independent-graphql-using-view-model-based-schemas/ from Microsoft, describing their approach to how to develop GraphQL schemas (see below).
type Query { channels(source: String!, query:String!, appId:String!, apiKey:String!): [Channel] lineCharts(source: String!, query:String!, appId:String!, apiKey:String!, filterKey:String, filterValues:[String]): [LineChart] pieCharts(source: String!, query:String!, appId:String!, apiKey:String!): [PieChart] barCharts(source: String!, query:String!, appId:String!, apiKey:String!, filterKey:String, filterValues:[String]): [BarChart] } type Channel { name: String id: Int } type LineChart { id: String seriesData : [Series] } type PieChart { id: String labels: [String] values: [Int] } type BarChart { id: String seriesData : [Series] } type Series { label: String x_values: [String] y_values: [Int] }
It seems to me that this design is strict, forcing any new schedule to be added to the root query. How can a schema be more general without losing the benefits of GraphQL?
source share