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

Respect user defined defaults for variables #466

Merged
merged 4 commits into from
Dec 8, 2023
Merged

Conversation

olirice
Copy link
Contributor

@olirice olirice commented Dec 7, 2023

What kind of change does this PR introduce?

When a user's query defines a default value, that value is currently ignored.

  query Units($first: Int = 3) {
    unitsCollection(first: $first) { 
      edges {
        node {
          id
          name
          desc
        }}}}

This PR changes the behavior so that the user defined default is respected when no value is explicitly passed.

Order of precedence is:

  • User provided value in a variable
  • User provided default in operation definition
  • Server side default value

Tasks

  • plumb the variable_definitions through everywhere
  • implement the user defined variable logic
  • tests, including value order of precedence

resolves #453

@olirice olirice requested a review from imor December 7, 2023 18:33
@olirice olirice marked this pull request as ready for review December 7, 2023 18:33
@imor imor merged commit 941c7c7 into master Dec 8, 2023
4 checks passed
@imor imor deleted the or/user-defined-default branch December 8, 2023 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

User provided default is ignored
2 participants