-
Notifications
You must be signed in to change notification settings - Fork 221
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
Support oneOf directive on input objects #1119
Conversation
79704d3
to
686a4c5
Compare
686a4c5
to
cf734e4
Compare
first of all, thanks for your contribution! For the missing validation, do you already have failing tests for it? It would save me time. |
I do not, as the tests I have setup aren't setup for variables. Testing something like this would be a basic case (and then also default values, if you get something setup I can add extra test cases) val schema = gql"""
type Query {
oneOfQuery(input: OneOfInput!)
}
input OneOfInput @oneOf {
foo: String
bar: Int
}
"""
val query = """
query Test($foo: String) {
oneOfQuery(input: { foo: $foo, bar: 123 })
}
"""
val variables = """{ "foo": "testing" }""" |
@@ -29,107 +29,116 @@ case class Executor[Ctx, Root]( | |||
operationName: Option[String] = None, | |||
variables: Input = emptyMapVars | |||
)(implicit um: InputUnmarshaller[Input]): Future[PreparedQuery[Ctx, Root, Input]] = { | |||
val (violations, validationTiming) = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is mostly just moving things around so queryValidator.validateQuery
has access to unmarshalledVariables
(split view might be easier)
same with similar places where things moved like this
01da0f8
to
c8ef4bd
Compare
@yanns I got something working (well passes the tests I added), though it causes some breaking changes with working on making sure build / tests passes but that change is in its own commit |
bea2b56
to
0d0929a
Compare
hmm moving validation after variable coercion (since we need that) needs a bit more tuning to make sure validation errors get thrown before variable coercion errors |
1087841
to
0388cef
Compare
QueryValidator needs access to variables now, so this causes a breaking change.
0388cef
to
d0c0e9d
Compare
alright...seems passing now |
let me know if think of a better way to check the variable values |
Just taking notes:
|
305bb0b
to
2fb639d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking good to me. I'll release a RC to test that with more code.
I almost forgot: we need to test for breaking changes (
|
ah thanks for the spec link! looks like the official spec doesn't like (from spec: I didn't do type checking since that's another area of sangria validation) will work on the breaking change one now edit: wait saw you did some commits already |
yes sorry, it was easier for me to push some changes directly. I've also pushed the changes for the breaking changes. |
got it thanks! I pushed the null check change + tests now |
oh miss, I force pushed some changes as the last commit from me was not complete (was missing the exceptions for the mina checks). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there anything left you'd like to add / change?
nope think this covers it all! thanks for the help! |
Issue:
#1068
WIP.
The main thing I'm missing is when checking that there's "exactly one non-null field" on a query (I have the
ExactlyOneOfFieldGiven
rule), I'm struggling with validating againstast.VariableValue
(since I need the unmarshalled input for that). (and considering default values forVariableDefinition
-- though that seems easier than getting the actual input)was wondering if it needs to go in the execution part for checking variables, but that seems a bit messier.
Trying to figure it out...but feel free to contribute if you have a way to go about that