Skip to content

fix: add graphql valid object annotation to all input and output types #45

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

Merged
merged 6 commits into from
Apr 26, 2024

Conversation

danadajian
Copy link
Collaborator

@danadajian danadajian commented Apr 26, 2024

📝 Description

  • Per the GraphQL Kotlin docs, we can use @GraphQLValidObjectLocations to restrict the use of a schema class as an input or output. With schema-first development, we want to enforce that schema is defined first up front. Thus we always want to be intentional about how the generated classes can be used.

🔗 Related Issues

@danadajian danadajian marked this pull request as ready for review April 26, 2024 16:21
@danadajian danadajian requested a review from a team as a code owner April 26, 2024 16:21
@@ -18,6 +18,7 @@ interface QueryCompletableFuture {
fun nonNullableResolver(arg: InputTypeGenerateFieldResolverInterfaces): java.util.concurrent.CompletableFuture<String>
}

@GraphQLValidObjectLocations(locations = [GraphQLValidObjectLocations.Locations.INPUT_OBJECT])

Choose a reason for hiding this comment

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

why does this need this annotation INPUT_OBJECT. This doesn't end with Input and also this is an interface.

Copy link
Collaborator Author

@danadajian danadajian Apr 26, 2024

Choose a reason for hiding this comment

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

This class is generated from this type which is an input

Copy link
Collaborator Author

@danadajian danadajian Apr 26, 2024

Choose a reason for hiding this comment

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

Basically any input that doesn't have a matching type is going to get this annotation

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

And vice versa - any type that doesn't have a matching input will get @GraphQLValidObjectLocations(locations = [GraphQLValidObjectLocations.Locations.OBJECT])

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Will add detailed docs on this later

Choose a reason for hiding this comment

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

Makes sense

@danadajian danadajian merged commit 9a40a3d into main Apr 26, 2024
1 check passed
@danadajian danadajian deleted the add-graphql-valid-object-annotation branch April 26, 2024 16:31
Copy link

🎉 This PR is included in version 2.1.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants