Skip to content

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
Development

Successfully merging this pull request may close these issues.

ObjectScalar throws graphql.AssertException: Internal error: should never happen: We have covered all Value types
2 participants