graphql-cost-analysis icon indicating copy to clipboard operation
graphql-cost-analysis copied to clipboard

Feature request

Open blacksmoke26 opened this issue 5 years ago • 0 comments

According to Docs, Cost multiply by array's length:

N.B: if the parameter is an array, its multiplier value will be the length of the array (cf EG2).

Can we have this for Objects too? For example:

input PagerOptions {
	before: String
	after: String
	page: Int = 1
	limit: Int = 10
}

type Query {
  sections ( pager: PagerOptions = {} ):
    SectionsConnection @cost(multipliers: ["pager.limit", "pager"], complexity: {min: 3})
}

If we do so:

query GetSections {
  sections (pager: {
    limit: 50, # Count: 1
    page: 10, # Count: 2
  }) {
    nodes {
      id
      status
    }
  }
}

Then final counts should be: 50 + 2 (50: limit, 1+1: pager fields) = 52

What you say? Is it worthy?

blacksmoke26 avatar Feb 27 '19 00:02 blacksmoke26