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

Abstract types: Update interface list #94

Conversation

ozanmakes
Copy link
Contributor

With this change, GraphiQL can list implementations of interfaces:

image

Copy link
Owner

@andreas andreas left a 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 😄

@@ -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)
| _ -> ());
Copy link
Owner

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 "..."

@ozanmakes ozanmakes force-pushed the update_abstract_type_interfaces branch from cc1b876 to 1599a18 Compare July 6, 2018 12:17
@ozanmakes ozanmakes force-pushed the update_abstract_type_interfaces branch from 1599a18 to 70c3a7f Compare July 6, 2018 12:19
@ozanmakes
Copy link
Contributor Author

@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.

@andreas andreas force-pushed the abstract-types branch 2 times, most recently from fc83b7c to 8617819 Compare July 16, 2018 07:07
@andreas andreas force-pushed the abstract-types branch 2 times, most recently from 026ebea to 013bfc6 Compare July 19, 2018 09:16
@andreas
Copy link
Owner

andreas commented Jul 20, 2018

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! 👍

@andreas andreas closed this Jul 20, 2018
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.

2 participants