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

feat: Add @GQLExcluded #1141

Merged
merged 3 commits into from
Nov 15, 2021
Merged

feat: Add @GQLExcluded #1141

merged 3 commits into from
Nov 15, 2021

Conversation

frekw
Copy link
Collaborator

@frekw frekw commented Nov 14, 2021

Closes #1040.

Didn't add support to exclude an enum member since it felt like it'd need special handling (what are we supposed to output as result if we were to get back a value that's GQLExcluded?).

Copy link
Owner

@ghostdogpr ghostdogpr left a comment

Choose a reason for hiding this comment

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

Looks good, just some minor comments.

@@ -64,6 +64,7 @@ trait SchemaDerivation[R] extends LowPriorityDerivedSchema {
Some(getName(ctx)),
getDescription(ctx),
ctx.parameters
.filter(p => !p.annotations.exists(_ == GQLExcluded()))
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 .filterNot(_.annotations.exists(_ == GQLExcluded()))?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

👍 didn't know that existed!

Copy link
Owner

Choose a reason for hiding this comment

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

Don't like p => p => _? 😆

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Haha sure! I sometimes try to shy away from multiple levels of _ but I think it's fine in this case!

core/src/main/scala/caliban/schema/Annotations.scala Outdated Show resolved Hide resolved
@ghostdogpr
Copy link
Owner

Can you also add it here: https://github.com/ghostdogpr/caliban/blob/master/vuepress/docs/docs/schema.md#annotations

But a separate PR would be great, so that I can merge the doc PR after the next release. That way it doesn't appear on the website before it's released (docs are updated right after they're merged to master).

@ghostdogpr ghostdogpr merged commit 3e8b5c4 into ghostdogpr:master Nov 15, 2021
@frekw frekw deleted the feat/gql-exclude branch November 15, 2021 06:12
@frekw
Copy link
Collaborator Author

frekw commented Nov 15, 2021

Absolutely, here's a separate PR: #1142

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.

Add @GQLExcluded annotation
2 participants