menu

Apollo

A community of developers, designers and others who love Apollo and GraphQL. 🚀

Channels
# All channels
view-forward
# General
view-forward
# Apollo Angular
view-forward
# Announcements
view-forward
# Apollo Android
view-forward
# Apollo Client
view-forward
# Apollo iOS
view-forward
# Apollo Link
view-forward
# Apollo Link Rest
view-forward
# Local State
view-forward
# Apollo Platform
view-forward
# Apollo Server
view-forward
# Apollo Tooling
view-forward
# Contributing
view-forward
# Docs
view-forward
# Events
view-forward
# GraphQL Tools
view-forward
# Jobs
view-forward
# Random
view-forward
# React Apollo
view-forward
# Showcase
view-forward
# Subscriptions
view-forward
# Testing
view-forward
# Vue Apollo
view-forward
Team

List is turned into object on resolver

March 19, 2020 at 3:53pm

List is turned into object on resolver

March 19, 2020 at 3:53pm (Edited 3 months ago)
Hi I'm running into an issue that I can't explain:
While extending an external type I need to access a list on the original object in the resolver:
in service 1:
type ProductConfiguration @key(fields: "internalName") {
internalName: ID!
productCriterias: [ProductCriteriaValue!]!
}
type Profile @key(fields: "uuid") {
uuid: ID!
productConfigurations: [ProductConfiguration!]
}
extending it in service 2:
extend type Profile @key(fields: "uuid") {
id: ID! @external
products: [Product!]! @requires(fields: "productConfigurations { internalName productCriterias { internalName value }}")
}
the resolver:
Profile: {
async availableProducts({
productConfigurations,
}: {
productConfigurations: ?$ReadOnlyArray<ProductConfiguration>,
},
_: void,
{ user }: Context) {
console.log(productConfigurations); // object { internalName: null, productCriterias: null }
return something;
}
I don't understand why it'd turn this into an object instead of null? Or at least an empty array. Anyone ran into this problem before? The query correctly returns null for productConfigurations.
No messages yet