We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It would be nice if you could somehow make resolving conditional whether i request subfieds at all:
ExampleData:
vehicleData = [ { licenseplate: "AB-CD123", customerNo: "1234" }, ... ] customerData = [ { CusteormNo: "1234", Name: "John Doe" } ]
How it is
schemas: type vehicle { licenseplate: String CustomerNo: String Customer: Customer } type Customer { CustomerNo: String Name: String } Resolver: Vehicle: { Customer: ({ CustomerNo }, args, context, info) => { return customers.find( x => x.CustomerNo == CustomerNo ) }, },
query for vehicle without customer: query ExampleQuery { vehicles{ licenseplate CustomerNo } } query for vehicle with customer: query ExampleQuery { vehicles{ licenseplate Customer { CustomerNo Name } } }
How i wish it would be
schemas: type vehicle { licenseplate: String Customer: String | Customer <- dynamic fields? } type Customer { CustomerNo: String Name: String } Resolver: Vehicle: { Customer: ({ Customer }, args, context, info) => { if( _noSubfields_ ) return Customer; /* no expensive resolving */ return customers.find( x => x.Customer== Customer) }, },
query for vehicle without customer: query ExampleQuery { vehicles{ licenseplate Customer } } query for vehicle with customer: query ExampleQuery { vehicles{ licenseplate Customer { CustomerNo Name } } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
It would be nice if you could somehow make resolving conditional whether i request subfieds at all:
ExampleData:
How it is
How i wish it would be
The text was updated successfully, but these errors were encountered: