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

validate that different instances of InputObjectType with the same name are the same #611

Merged
merged 2 commits into from
Apr 9, 2021

Conversation

yanns
Copy link
Contributor

@yanns yanns commented Apr 9, 2021

The validation only checks the field names. It cannot catch all cases, but I think it should be sufficient for 99% of the cases.

…me are the same

The validation only check the field names. It cannot catch all cases, but I think it should be sufficient for 99% of the cases.
case Some(found) if !sameType(found._2, t) =>
typeConflict(t.name, found._2, t, parentInfo)
if (t.isInstanceOf[ScalarAlias[_, _]] && found._2.isInstanceOf[ScalarType[_]])
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've extracted the if to avoid calling sameType several times.

Copy link

@xsoufiane xsoufiane left a comment

Choose a reason for hiding this comment

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

looks 💯, just a taught maybe you can also add a test to check the case of different field names (not just different classes)

Copy link
Contributor

@nikola-mladenovic nikola-mladenovic left a comment

Choose a reason for hiding this comment

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

💯

@yanns
Copy link
Contributor Author

yanns commented Apr 9, 2021

looks 💯, just a taught maybe you can also add a test to check the case of different field names (not just different classes)

Actually, we only test different field names as the class is not persisted with InputObjectType. I'll update the test name.

@yanns yanns merged commit 7686938 into master Apr 9, 2021
@yanns yanns deleted the validate_incompatible_InputObjectType branch April 9, 2021 10:57
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.

3 participants