Replies: 1 comment 3 replies
-
I fully agree that connecting fields to args is something that users want to do often. Pretending that this concept is useful for all of GraphQL this is how I imagine some spec/directives would operation on one singular schema (which can be viewed as the result we get from composition or a traditional schema) type SomeType {
someValue: Int
someField(someArg: Int): String @sourceArgValueFrom(argMaping: { "someArg": "{ someValue }" })
} Where What clients want to see: type SomeType {
someValue: Int
# Clients can now query without passing an arg
# Metadata saved internally or in directives or old fields hidden with @internal
someField: String @sourceArgValueFrom(argMaping: { "someArg": "{ someValue }" })
} Now when it comes to composition across graphs I don't see any issue with supporting that logic as we can view this as a custom directive with composition. If you want to apply custom transformation that can happen after the composition step as compostion doesn't need to value your custom directives (ie it's not an issue that in Subschema B we reference a non-existant field when viewed from before composition) # Subschema A
type SomeType {
someValue: Int
} # Subschema B
type SomeType {
someField(someArg: Int): String @sourceArgValueFrom(argMaping: { "someArg": "{ someValue }" })
} After composition we should still get the same merged schema: # Composed schema
type SomeType {
someValue: Int
someField(someArg: Int): String @sourceArgValueFrom(argMaping: { "someArg": "{ someValue }" })
} And then you can pass the above merged schema to your transformer library just like normal. This doesn't require the composer to know anything about these directives or validate them if those steps happen either before or after. It would be up to implementations to provide these exhaustive checks on their platform if you want to support all those features. What would be an example where the composer needs to do something as part of merging? |
Beta Was this translation helpful? Give feedback.
-
One general question is whether
schema transformation
is within the scope ofschema composition
. It would certainly be easier to leave as much out of the scope as possible, but two types of schema transformations happen to be very useful for composition. I imagine we will want to include them within the scope, I am just calling them out because if we do want to leave space for a future transformation sub-specification, we might want to think about how these transformations fit into that broader context. Apologies is this is a bit rough around the edges or too elementary or plain wrong. :)Argument Filtering between the public composite schema and the merged schema
Imagine a subchema A that specified some of
SomeType
as follows:Now imagine another subschema B that specified some of
SomeType
as follows:If the composite schema will end up having the following portion of
Query
:and imagine against that the composite schema is
the executior would presumably reach to
Subschema B
forsomeValue
and then accessSubschemaA
forsomeField
usingsomeValue
.It might be undesirable to expose the composite schema as
Field filtering
Each subschema if it operates without an
entities
accessor needs to provide accessors for all of the entities. It may be desirable to filter these from the public composite schema.Beta Was this translation helpful? Give feedback.
All reactions