Replies: 1 comment 3 replies
-
Interesting. First I think we would need to clarify some terms here. In your example, we are still defining GraphQL SCHEMAS that we want to merge not OPERATIONS, which are different artifacts and have different syntax. From that your second example is not valid GraphQL so while we could adopt some new syntax for the GraphQL language and propose that to the core spec, that would most likely not get far as it would slow the process down for the composition-wg. With that in mind I think you are after these key points:
Is that correct or are you proposing a composition process that can actually take into account an operation definition without knowing the schema definition and merge those together? We could merge the first example easier than the second one, it just requires you define both a # Schema1.graphqls
type Query {
pokemon(name: String): Pokemon
}
type Pokemon {
name: String
type: String
}
# ------
# Schema2.graphqls
extend type Query {
pikachu: Pokemon
} Merging schema + operations # Schema1.graphqls
type Query {
pokemon(name: String): Pokemon
}
type Pokemon {
name: String
type: String
}
# ------
# Operation1.graphql
query MyCustomQuery {
pikachu: pokemon(name: "pikachu") {
name
}
} Are you trying to define hard coded resolvers via aliases? |
Beta Was this translation helpful? Give feedback.
-
really simple example (please excuse syntax)
pokemon graph:
my graph:
result:
I was hoping composing graphs could be as simple as composing components. Apologies if this is too out there, but figured it could be worth an async discussion. I think it makes a lot of sense for the proposals to have inspiration from current directive-heavy composition approaches popularized by many vendors, and indirectly the flatter microservice architectures, but I think they aim to build a single graph and I don't think this is a good goal when considering composition.
I would love to treat graphs closer to scopes and imports from other languages. Directives shouldn't be the basis of composition. It should be as simple as above, but with some directives for translation, manipulation, conforming, etc. purposes only.
Beta Was this translation helpful? Give feedback.
All reactions