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
Hi All, I have the situation where I have multiple graphql backends and they all define a custom scalar named MyBigInt.
Now, I integrate all these backends into Wundergraph using namespaces so I get ns1_MyBigInt, ns2_MyBigInt and ns3_MyBigInt.
I want to write a Wundergraph operation that joins across ns1 and ns2 whereby ns1 returns an ns1_MyBigInt in a field, and I use that for an operation on ns2 which expects an ns2_MyBigInt. I get a problem with the join because the types are not matching.
What I thought is I can either remove the common scalars to a common schema, but then importing the other schemas without the MyBigInt definition fails. In this case, I would need to be able to disable schema validation.
An alternative is to disable adding namespaces on some given typelist - but I cannot find an option for that.
Another alternative is to rename the types somehow during the configuration phase.
If someone could please help me with how to resolve my issue, I would be very grateful
ns1 schema:
scalar MyBigInt
type Widget {
id: MyBigInt!
location: String
}
type Query {
getWidget(id: MyBigInt): Widget
}
incoming request: POST /graphql HTTP/1.1
{"query":"query test($sl: ns1_MyBigInt! @internal) {\n ns2_getThing(id: 24) {\n description\n name\n widgetId @export(as: \"wid\")\n _join {\n ns1_getWidget(id: $wid) {\n location\n } \n }\n }\n}","operationName":"test"}
--- DebugTransport ---
Request:
POST /api/ns2 HTTP/1.1
{"variables":{"a":24},"query":"query($a: Int!){ns2_getThing: getThing(id: $a){description name widgetId}}"}
Duration: 866.078938ms
Response:
HTTP/2.0 200 OK
Content-Length: 96
Content-Type: application/json
Date: Fri, 13 Oct 2023 00:34:44 GMT
Server: uvicorn
{"data":{"ns2_getThing":{"description":"My Thing","name":"MyThing","widgetId":377}}}
--- DebugTransport
--- DebugTransport ---
Request:
POST /api/ns1 HTTP/1.1
{"variables":{},"query":"query($wid: MyBigInt!){ns1_getWidget: getWidget(id: $wid){location}}"}
Duration: 1.316574805s
Response:
HTTP/2.0 200 OK
Content-Length: 132
Content-Type: application/json
Date: Fri, 13 Oct 2023 00:34:46 GMT
Server: uvicorn
{"data":null,"errors":[{"message":"Variable '$wid' of required type 'MyBigInt!' was not provided.","locations":[{"line":1,"column":7}]}]}
--- DebugTransport
outgoing response: HTTP/1.1 200 OK
Connection: close
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: *
Content-Type: application/json
Vary: Origin
{"errors":[{"message":"Variable '$wid' of required type 'MyBigInt!' was not provided.","locations":[{"line":1,"column":7}]}],"data":{"ns2_getThing":{"description":"My Thing","name":"MyThing","widgetId":377,"_join":{"ns1_getWidget":null}}}}
The above info has been sanitised so excuse missing headers/urls etc..
2 directions out of this I can see (there's surely more), not sure what works best on the Wundergraph side:
Allow a user to disable schema validation for an endpoint - This means we could use partial namespaced schemas.
(preferred) Disable addition of namespaces on a given typelist - like I guess is done with skipRenameRootFields: skipRenameTypes(names: [str], remove: bool) - "remove" would remove the type from the output, because the configurer knows they are included by another schema. Alternatively to the "remove" flag, Wundergraph could handle identically defined types (not just identically named) by not including duplicates in the final merged schema.
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 All, I have the situation where I have multiple graphql backends and they all define a custom scalar named MyBigInt.
Now, I integrate all these backends into Wundergraph using namespaces so I get ns1_MyBigInt, ns2_MyBigInt and ns3_MyBigInt.
I want to write a Wundergraph operation that joins across ns1 and ns2 whereby ns1 returns an ns1_MyBigInt in a field, and I use that for an operation on ns2 which expects an ns2_MyBigInt. I get a problem with the join because the types are not matching.
What I thought is I can either remove the common scalars to a common schema, but then importing the other schemas without the MyBigInt definition fails. In this case, I would need to be able to disable schema validation.
An alternative is to disable adding namespaces on some given typelist - but I cannot find an option for that.
Another alternative is to rename the types somehow during the configuration phase.
If someone could please help me with how to resolve my issue, I would be very grateful
ns1 schema:
ns2 schema:
wundergraph config:
Query entered into the Wundergraph graphql interface:
Log:
The above info has been sanitised so excuse missing headers/urls etc..
2 directions out of this I can see (there's surely more), not sure what works best on the Wundergraph side:
Beta Was this translation helpful? Give feedback.
All reactions