You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to build some schema stitching. In my CMS a user can define a JSON field and at the moment I create an untyped GraphQL schema for this field. So like "Any".
I would like to improve that and let the user define a custom schema for this field. So the user would define the schema in the UI:
Then the first type would become the field type. I have built a prototype. I just create a new schema:
var schema2 = Schema.For(@"
type Result {
rootString: String
rootNumber: Int
rootBoolean: Boolean,
rootArray: [String]
rootObject: Nested
}
type Nested {
nestedString: String
nestedNumber: Int
nestedBoolean: Boolean,
nestedArray: [String]
}
");
var schema = Schema.For(@"
type Query {
result: String
}
");
foreach (var type in schema2.AdditionalTypeInstances)
{
schema.RegisterType(type);
}
var query = (IComplexGraphType)schema.AdditionalTypeInstances.First();
query.Fields.First().ResolvedType = schema2.AdditionalTypeInstances.First();
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
I would like to build some schema stitching. In my CMS a user can define a JSON field and at the moment I create an untyped GraphQL schema for this field. So like "Any".
I would like to improve that and let the user define a custom schema for this field. So the user would define the schema in the UI:
Then the first type would become the field type. I have built a prototype. I just create a new schema:
How can I do something like this for input types?
Beta Was this translation helpful? Give feedback.
All reactions