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

Handle unions, intersections and lists when generating sample GQL #49

Conversation

cliftonmcintosh
Copy link
Contributor

@cliftonmcintosh cliftonmcintosh commented Jun 30, 2024

This corrects some problems with generation of sample GQL by handling the following return types:

  1. Unions
  2. Interfaces
  3. Lists
  4. Non-null lists

Testing

  • Run mix test and make sure unit tests pass
  • Run mix test and verify the output in the markup files
  • Run this version of the code on a set of sample repos and verify that it succeeds and the output looks correct.

I ran this on 9 repos in my organization and verified that it succeeded and the output looked correct.

Sample output

For each of these, see the updates to schema.json for more specifics.

Unions

In this example, the return type is LoginResponseV2, a union of LoginResponse and UnexpectedRequest.

Screenshot 2024-06-30 at 1 33 15 PM

Interfaces

In this example, the return type is Character, which is an interface implemented by Human and Droid.

Screenshot 2024-06-30 at 1 34 56 PM

Lists

In this example, the return type is a list of Droid objects.

Screenshot 2024-06-30 at 1 37 38 PM

Non-null return types

In this example, the return type is a non-null list of Human objects.

Screenshot 2024-06-30 at 1 38 50 PM

@cliftonmcintosh cliftonmcintosh force-pushed the cmcintosh/handle_union_and_interface_types branch from 2da6473 to 76fbd01 Compare June 30, 2024 16:32
@cliftonmcintosh cliftonmcintosh marked this pull request as ready for review June 30, 2024 18:39
@cliftonmcintosh cliftonmcintosh requested a review from a team as a code owner June 30, 2024 18:39
@cliftonmcintosh cliftonmcintosh changed the title Handle unions, intersections and lists Handle unions, intersections and lists when generating sample GQL Jun 30, 2024
CHANGELOG.md Outdated Show resolved Hide resolved
test/fixtures/schema.json Show resolved Hide resolved
test/fixtures/schema.json Show resolved Hide resolved
test/fixtures/schema.json Show resolved Hide resolved
test/fixtures/schema.json Show resolved Hide resolved
test/fixtures/schema.json Show resolved Hide resolved
test/fixtures/schema.json Show resolved Hide resolved
@cliftonmcintosh cliftonmcintosh merged commit 1f604f1 into podium:master Jul 2, 2024
12 checks passed
@cliftonmcintosh cliftonmcintosh deleted the cmcintosh/handle_union_and_interface_types branch July 2, 2024 14:26
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.

3 participants