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

Fix bug when NullValue is nested inside ObjectValue #91

Merged
merged 1 commit into from
Jan 24, 2023

Conversation

dondonz
Copy link
Member

@dondonz dondonz commented Jan 22, 2023

Fixes #90, thanks @Kingson-de for reporting!

Enables NullValue to be nested inside ObjectValue.

@dondonz dondonz changed the title Fix bug where NullValue is nested inside ObjectValue Fix bug when NullValue is nested inside ObjectValue Jan 22, 2023
parsedValue = null;
} else {
parsedValue = parseLiteral(fld.getValue(), variables);
}
parsedValues.put(fld.getName(), parsedValue);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The overall Object value is guaranteed not to be NullValue as this is handled earlier in GraphQL Java, however it may contain a nested NullValue.

@@ -54,7 +54,6 @@ public Object parseValue(Object input) throws CoercingParseValueException {
@Override
public Object parseLiteral(Object input) throws CoercingParseLiteralException {
// on purpose - object scalars can be null
//noinspection ConstantConditions
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IDE said this is redundant


mkObjectValue([
field1: mkNullValue()
] as Map<String, Value>) | [field1: null] // Nested NullValue inside ObjectValue
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test fails with the old behaviour, and passes with the new behaviour

@dondonz dondonz merged commit babda5f into master Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants