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've been looking at the documentation, and this seems like a decent tool for our use case.
However, we have certain complexity characteristics, that I'm not sure if we can calculate correctly. Please advise if these scenarios are supported:
1. Groups of fields with combined complexity
We're using apollo server as a gateway, that resolves all queries by making API calls to a back-end. For some types, there are some fields that are always included with the resource (basically zero cost), and there are other fields that require an additional round-trip to the back-end. If one or more of these fields are included, we need to make that extra round-trip, so basically any additional field will have zero cost:
typeUser {
# "zero-cost" fieldsid: String!name: String!email: String! # one or more of these fields will add a cost, but if we include one, # it doesn't matter if we include all of themaddress: String!phone: String!birthDate: String!
}
We want a significant complexity value to be added, if any of the fields address, phone or birthDate are included in the query, but we don't want it to add up, if several of these fields are included.
In this scenario, we have a back-end API method that returns all users. We have another API method that returns all messages to all users. If we have a query like this:
{ allUsers {
idmessages { idtext }
}
We only need to make two API calls. So the cost of including the messages doesn't depend on the number of users. This seems like a use-case for setting useMultipliers to false.
However, if we include the seenBy field, it will trigger an extra API call for every message, so in that case, we do want multipliers for the number of users and messages to apply. Is this scenario possible with this library?
The text was updated successfully, but these errors were encountered:
I've been looking at the documentation, and this seems like a decent tool for our use case.
However, we have certain complexity characteristics, that I'm not sure if we can calculate correctly. Please advise if these scenarios are supported:
1. Groups of fields with combined complexity
We're using apollo server as a gateway, that resolves all queries by making API calls to a back-end. For some types, there are some fields that are always included with the resource (basically zero cost), and there are other fields that require an additional round-trip to the back-end. If one or more of these fields are included, we need to make that extra round-trip, so basically any additional field will have zero cost:
We want a significant complexity value to be added, if any of the fields
address
,phone
orbirthDate
are included in the query, but we don't want it to add up, if several of these fields are included.2. Batch requests for nested resources
Another scenario is like this:
In this scenario, we have a back-end API method that returns all users. We have another API method that returns all messages to all users. If we have a query like this:
We only need to make two API calls. So the cost of including the
messages
doesn't depend on the number of users. This seems like a use-case for settinguseMultipliers
tofalse
.However, if we include the
seenBy
field, it will trigger an extra API call for every message, so in that case, we do want multipliers for the number of users and messages to apply. Is this scenario possible with this library?The text was updated successfully, but these errors were encountered: