Skip to content
New issue

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

Validate complexity of documents #1

Open
Tracked by #2441
kamilkisiela opened this issue Nov 18, 2018 · 1 comment
Open
Tracked by #2441

Validate complexity of documents #1

kamilkisiela opened this issue Nov 18, 2018 · 1 comment
Labels
⛑️ help wanted Extra attention is needed
Milestone

Comments

@kamilkisiela
Copy link
Owner

kamilkisiela commented Nov 18, 2018

  • Default complexity value should be 1
  • Allow to define complexity by a directive
  • Allow to match complexity value based on an argument (tricky and impossibru)
@kamilkisiela kamilkisiela added the ⛑️ help wanted Extra attention is needed label Jan 14, 2019
@zionts
Copy link

zionts commented Dec 17, 2019

Very excited about this! I've thought about this concept quite a bit, and it's exciting to see it gain some traction in the community :)

I think that this should begin with defining some sort of specification for how to complexity of an operation is computed from the complexity of fields and how this works with arrays.

For instance, I could imagine a schema along the lines of

type user {
  id: ID!
  name: String!
  favoriteColor: String @complexity(static: 3)
  friends: [User!]! @complexity(per-item: 1)

wherein a query such as

query FriendsFavoriteColors {
  user(id: "foo") {
    id
    friends {
      name
      favoriteColor
    }
  }

would be scored perhaps dynamically based on the size of the list, and where friends with a null favorite color might not have the same complexity cost of 3. At the end of the day, this feature should be built in mind with trying to support some kind of complexity limiting, and I think needs to start with a definition of how operations interact with schema-defined complexity to receive scores.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⛑️ help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants