-
Notifications
You must be signed in to change notification settings - Fork 59
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
Abstract types: Update interface list #94
Abstract types: Update interface list #94
Conversation
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.
Good catch! Do you want to add a test case as well? Otherwise I can help 😄
graphql/src/graphql_schema.ml
Outdated
@@ -391,6 +391,9 @@ module Make(Io : IO) = struct | |||
| Abstract a -> | |||
(* TODO add subtype check here *) | |||
a.types <- (AnyTyp typ)::a.types; | |||
(match (a, typ) with | |||
| ({ kind= `Interface _; _}, Object o) -> o.interfaces := a :: !(o.interfaces) | |||
| _ -> ()); |
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.
How about matching on both abstract_typ
and typ
in the outer match
?
match abstract_typ, typ with
| Abstract ({ kind = `Interface _; _ } as a), Object o ->
(* TODO add subtype check here *)
a.types <- (AnyTyp typ)::a.types;
o.interfaces := a :: !o.interfaces
| Abstract ({ kind = `Union; _ } as a), Object o ->
a.types <- (AnyTyp typ)::a.types
| _ ->
failwith "..."
cc1b876
to
1599a18
Compare
1599a18
to
70c3a7f
Compare
@andreas done! I added a test checking the introspection query result for both unions and interfaces. Let me know if you had something more specific in mind. |
fc83b7c
to
8617819
Compare
026ebea
to
013bfc6
Compare
Thanks for the test case! I ended up rolling these changes into #70 and adapted them slightly to fix another issue. I appreciate the contribution! 👍 |
With this change, GraphiQL can list implementations of interfaces: