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

Field argument change to/from default_value = nil not detected #43

Open
tgwizard opened this issue Dec 9, 2021 · 0 comments
Open

Field argument change to/from default_value = nil not detected #43

tgwizard opened this issue Dec 9, 2021 · 0 comments

Comments

@tgwizard
Copy link

tgwizard commented Dec 9, 2021

I think this is partly because of

if old_arg.default_value != new_arg.default_value
changes << Changes::FieldArgumentDefaultChanged.new(type, field, old_arg, new_arg)
end

I believe default_value is nil both for the case when it's not set and when it's set to nil, so we might need to add || old_arg.default_value? != new_arg.default_value?.

Then there's also

def message
if old_argument.default_value.nil? || old_argument.default_value == :__no_default__
"Default value `#{new_argument.default_value}` was added to argument `#{new_argument.graphql_name}` on field `#{type.graphql_definition}.#{field.graphql_name}`"
else
"Default value for argument `#{new_argument.graphql_name}` on field `#{type.graphql_definition}.#{field.name}` changed"\
" from `#{old_argument.default_value}` to `#{new_argument.default_value}`"
end
end

Which renders poorly when default_value = nil (since nil becomes the empty string).

(Apologies for only submitting a bug report and not test cases or a PR fixing this. I had some weird issues getting the tests to pass deterministically locally...)

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

No branches or pull requests

1 participant