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

Rule to mandate input of a mutation as required #1929

Open
gituserjava opened this issue Oct 13, 2023 · 7 comments
Open

Rule to mandate input of a mutation as required #1929

gituserjava opened this issue Oct 13, 2023 · 7 comments
Labels
help wanted Extra attention is needed new rule

Comments

@gituserjava
Copy link

gituserjava commented Oct 13, 2023

Allow

type Mutation {
  createEmployee(input: EmployeeInput!)
}

Disallow

type Mutation {
  createEmployee(input: EmployeeInput)
}
@gituserjava gituserjava changed the title Rule to mandate input of a mutation as required Rule to mandate input of a mutation as required only at the top level Oct 13, 2023
@gituserjava gituserjava changed the title Rule to mandate input of a mutation as required only at the top level Rule to mandate input of a mutation as required Oct 13, 2023
@dimaMachina
Copy link
Owner

Why do you think this rule should be part of graphql-eslint?

@gituserjava
Copy link
Author

@B2o5T, sorry there was a typo in my original example, I fixed it now.

Additional context is that we want to enforce all mutations have non-null Input. If we don't have exclamation mark the input becomes optional and we do not want optional inputs.

@gituserjava
Copy link
Author

Will you be planning to add this rule?

@gituserjava
Copy link
Author

@dimaMachina , could you please let me know if you have any plans to implement this rule?

@dimaMachina
Copy link
Owner

@gituserjava This rule is accepted, if you want you can work on it and send a PR

@dimaMachina dimaMachina added help wanted Extra attention is needed new rule labels Dec 10, 2023
@gituserjava
Copy link
Author

I forked the repository and will explore on this based on my availability.

Quick question, which command should I use to run the test and see the result? For example, I want to test "input-name.spec.ts".

@dimaMachina
Copy link
Owner

vitest input-name.spec.ts

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 new rule
Projects
None yet
Development

No branches or pull requests

2 participants