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: more thorough validation of join arguments #1489

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

obmarg
Copy link
Member

@obmarg obmarg commented Mar 22, 2024

Prior to this change the arguments we pass in to a join were not validated very much. The assumption was that any errors would be caught when someone tried to run the join. But, now that joins are getting more complicated and variables present in them can come from more places, it makes sense to put the effort into improving this a bit.

And, that's what this commit does. We now check that variables exist, check that they have compatible types and also similarly check that any literals in the string approximately make sense. I don't expect that we'll catch every single error with this, but it should catch the dumbest of them. In particular I've been quite lax on validating scalars - I don't want to stop block things that are technically wrong but in reality fine (e.g. passing a String to an ID field or vice versa). It could probably be made a little stricter, but lets get this out there and see how it does.

One thing to note is that i haven't done list coercion here. Mostly because it's complex enough as it is and I don't want to add that extra complexity. If someone really wants it we can revisit.

Fixes GB-6305

@obmarg obmarg requested a review from a team as a code owner March 22, 2024 15:11
@obmarg obmarg requested a review from jakubadamw March 22, 2024 15:11
Copy link

linear bot commented Mar 22, 2024

We need to do this to properly support composite keys in our subgraph join support.
Comment on lines +477 to +479
Some(
(MetaType::InputObject(_), MetaType::Object(_))
| (MetaType::Object(_), MetaType::InputObject(_)),
Copy link
Member Author

@obmarg obmarg Mar 22, 2024

Choose a reason for hiding this comment

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

Might need to do something similar around enums here to handle TAs case :|

@obmarg
Copy link
Member Author

obmarg commented Mar 25, 2024

I don't think this can be merged in its current form, so making draft till I get time to fix.

@obmarg obmarg marked this pull request as draft March 25, 2024 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants