From f8baa947337ba84c56e4624d1030749529c97c0f Mon Sep 17 00:00:00 2001 From: Jan Paulovcak Date: Sun, 21 Mar 2021 02:50:13 +0100 Subject: [PATCH] Generate annotations for mutation and query parameters #602 (#603) --- .../java-lang/javaClassGraphqlOperations.ftl | 2 +- .../GraphQLCodegenAnnotationsTest.java | 1 + .../expected-classes/CommitResolver.java.txt | 4 +- .../CreateEventMutationResolver.java.txt | 2 +- .../EventByIdQueryResolver.java.txt | 2 +- ...sByCategoryAndStatusQueryResolver.java.txt | 2 +- .../EventsByIdsQueryResolver.java.txt | 2 +- .../MutationResolver.java.txt | 2 +- ...yCategoryIdAndStatusQueryResolver.java.txt | 2 +- .../ProductsByIdsQueryResolver.java.txt | 2 +- .../expected-classes/QueryResolver.java.txt | 6 +- .../CreateEventMutationResolver.java.txt | 2 +- .../annotation/MutationResolver.java.txt | 2 +- ...ryResolver_withoutThrowsException.java.txt | 2 +- ...onResolver_withoutThrowsException.java.txt | 134 +++++++++--------- .../CreateEventMutationResolver.java.txt | 2 +- .../deprecated/MutationResolver.java.txt | 2 +- .../CreateAssetMutationResolver.java.txt | 2 +- .../CreateEventMutationResolver.java.txt | 2 +- .../MutationResolver.java.txt | 4 +- .../CreateAssetMutationResolver.java.txt | 2 +- .../CreateEventMutationResolver.java.txt | 2 +- .../extend/MutationResolver.java.txt | 4 +- .../CreateMutationResolver.java.txt | 2 +- .../MutationResolver.java.txt | 2 +- .../ProductByIdQueryResolver.java.txt | 2 +- .../ProductsByIdsQueryResolver.java.txt | 2 +- .../QueryResolver.java.txt | 4 +- .../optional/NodeQueryResolver.java.txt | 2 +- .../optional/NodeQueryResolver_mono.java.txt | 2 +- .../optional/NodesQueryResolver.java.txt | 2 +- .../optional/QueryResolver.java.txt | 34 ++--- .../CreateEventMutationResolver.java.txt | 2 +- .../MutationResolver.java.txt | 2 +- .../parent-interfaces/QueryResolver.java.txt | 6 +- src/test/resources/schemas/test.graphqls | 3 +- 36 files changed, 127 insertions(+), 125 deletions(-) diff --git a/src/main/resources/templates/java-lang/javaClassGraphqlOperations.ftl b/src/main/resources/templates/java-lang/javaClassGraphqlOperations.ftl index ea1d463a..509e58f6 100644 --- a/src/main/resources/templates/java-lang/javaClassGraphqlOperations.ftl +++ b/src/main/resources/templates/java-lang/javaClassGraphqlOperations.ftl @@ -35,7 +35,7 @@ public interface ${className}<#if implements?has_content> extends <#list impleme <#list operation.annotations as annotation> @${annotation} - ${operation.type} ${operation.name}(<#list operation.parameters as param>${param.type} ${param.name}<#if param_has_next>, )<#if operation.throwsException> throws Exception; + ${operation.type} ${operation.name}(<#list operation.parameters as param><#list param.annotations as paramAnnotation>@${paramAnnotation}<#if param.annotations?has_content> ${param.type} ${param.name}<#if param_has_next>, )<#if operation.throwsException> throws Exception; } diff --git a/src/test/java/com/kobylynskyi/graphql/codegen/GraphQLCodegenAnnotationsTest.java b/src/test/java/com/kobylynskyi/graphql/codegen/GraphQLCodegenAnnotationsTest.java index 0e916b6e..9965572f 100644 --- a/src/test/java/com/kobylynskyi/graphql/codegen/GraphQLCodegenAnnotationsTest.java +++ b/src/test/java/com/kobylynskyi/graphql/codegen/GraphQLCodegenAnnotationsTest.java @@ -208,6 +208,7 @@ class GraphQLCodegenAnnotationsTest { "float={{float?toArrayOfStrings}}, " + "int={{int}}, " + "n={{n?toString}})")); + directiveAnnotationsMapping.put("valid", singletonList("@javax.validation.Valid")); mappingConfig.setDirectiveAnnotationsMapping(directiveAnnotationsMapping); new JavaGraphQLCodegen(singletonList("src/test/resources/schemas/test.graphqls"), diff --git a/src/test/resources/expected-classes/CommitResolver.java.txt b/src/test/resources/expected-classes/CommitResolver.java.txt index 1e450693..56e7e97b 100644 --- a/src/test/resources/expected-classes/CommitResolver.java.txt +++ b/src/test/resources/expected-classes/CommitResolver.java.txt @@ -14,12 +14,12 @@ public interface CommitResolver { @javax.validation.constraints.NotNull @com.fasterxml.jackson.databind.annotation.JsonDeserialize(using = com.example.json.DateTimeScalarDeserializer.class) - Blame blame(Commit commit, String path, graphql.schema.DataFetchingEnvironment env) throws Exception; + Blame blame(Commit commit, @javax.validation.constraints.NotNull String path, graphql.schema.DataFetchingEnvironment env) throws Exception; @javax.validation.constraints.NotNull CommitCommentConnection comments(Commit commit, String after, String before, Integer first, Integer last, graphql.schema.DataFetchingEnvironment env) throws Exception; - DeploymentConnection deployments(Commit commit, String after, String before, java.util.List environments, Integer first, Integer last, DeploymentOrder orderBy, graphql.schema.DataFetchingEnvironment env) throws Exception; + DeploymentConnection deployments(Commit commit, String after, String before, @javax.validation.constraints.NotNull java.util.List environments, Integer first, Integer last, DeploymentOrder orderBy, graphql.schema.DataFetchingEnvironment env) throws Exception; @javax.validation.constraints.NotNull CommitHistoryConnection history(Commit commit, String after, CommitAuthor author, String before, Integer first, Integer last, String path, String since, String until, graphql.schema.DataFetchingEnvironment env) throws Exception; diff --git a/src/test/resources/expected-classes/CreateEventMutationResolver.java.txt b/src/test/resources/expected-classes/CreateEventMutationResolver.java.txt index 19cb95a0..e3be51a1 100644 --- a/src/test/resources/expected-classes/CreateEventMutationResolver.java.txt +++ b/src/test/resources/expected-classes/CreateEventMutationResolver.java.txt @@ -14,6 +14,6 @@ public interface CreateEventMutationResolver { * Create a new event. */ @javax.validation.constraints.NotNull - Event createEvent(String categoryId, String createdBy) throws Exception; + Event createEvent(@javax.validation.constraints.NotNull String categoryId, String createdBy) throws Exception; } \ No newline at end of file diff --git a/src/test/resources/expected-classes/EventByIdQueryResolver.java.txt b/src/test/resources/expected-classes/EventByIdQueryResolver.java.txt index 34d8093c..b2ceea78 100644 --- a/src/test/resources/expected-classes/EventByIdQueryResolver.java.txt +++ b/src/test/resources/expected-classes/EventByIdQueryResolver.java.txt @@ -14,6 +14,6 @@ public interface EventByIdQueryResolver { * Single event by ID. */ @javax.validation.constraints.NotNull - Event eventById(String id) throws Exception; + Event eventById(@javax.validation.constraints.NotNull String id) throws Exception; } \ No newline at end of file diff --git a/src/test/resources/expected-classes/EventsByCategoryAndStatusQueryResolver.java.txt b/src/test/resources/expected-classes/EventsByCategoryAndStatusQueryResolver.java.txt index 08136cb0..285c5e01 100644 --- a/src/test/resources/expected-classes/EventsByCategoryAndStatusQueryResolver.java.txt +++ b/src/test/resources/expected-classes/EventsByCategoryAndStatusQueryResolver.java.txt @@ -14,6 +14,6 @@ public interface EventsByCategoryAndStatusQueryResolver { * List of events of a specified category. */ @javax.validation.constraints.NotNull - java.util.List eventsByCategoryAndStatus(String categoryId, EventStatus status) throws Exception; + java.util.List eventsByCategoryAndStatus(@javax.validation.constraints.NotNull String categoryId, EventStatus status) throws Exception; } \ No newline at end of file diff --git a/src/test/resources/expected-classes/EventsByIdsQueryResolver.java.txt b/src/test/resources/expected-classes/EventsByIdsQueryResolver.java.txt index 166868dc..13b4f9a3 100644 --- a/src/test/resources/expected-classes/EventsByIdsQueryResolver.java.txt +++ b/src/test/resources/expected-classes/EventsByIdsQueryResolver.java.txt @@ -14,6 +14,6 @@ public interface EventsByIdsQueryResolver { * Events by IDs. */ @javax.validation.constraints.NotNull - java.util.List eventsByIds(java.util.List ids) throws Exception; + java.util.List eventsByIds(@javax.validation.constraints.NotNull java.util.List ids) throws Exception; } \ No newline at end of file diff --git a/src/test/resources/expected-classes/MutationResolver.java.txt b/src/test/resources/expected-classes/MutationResolver.java.txt index 05cda4d0..bef9d6cf 100644 --- a/src/test/resources/expected-classes/MutationResolver.java.txt +++ b/src/test/resources/expected-classes/MutationResolver.java.txt @@ -11,6 +11,6 @@ public interface MutationResolver { * Create a new event. */ @javax.validation.constraints.NotNull - Event createEvent(String categoryId, String createdBy) throws Exception; + Event createEvent(@javax.validation.constraints.NotNull String categoryId, String createdBy) throws Exception; } \ No newline at end of file diff --git a/src/test/resources/expected-classes/ProductsByCategoryIdAndStatusQueryResolver.java.txt b/src/test/resources/expected-classes/ProductsByCategoryIdAndStatusQueryResolver.java.txt index 7c32af7e..384ba3ab 100644 --- a/src/test/resources/expected-classes/ProductsByCategoryIdAndStatusQueryResolver.java.txt +++ b/src/test/resources/expected-classes/ProductsByCategoryIdAndStatusQueryResolver.java.txt @@ -7,6 +7,6 @@ package com.kobylynskyi.graphql.test1; ) public interface ProductsByCategoryIdAndStatusQueryResolver { - java.util.List products(String categoryId, String status) throws Exception; + java.util.List products(@javax.validation.constraints.NotNull String categoryId, @javax.validation.constraints.NotNull String status) throws Exception; } \ No newline at end of file diff --git a/src/test/resources/expected-classes/ProductsByIdsQueryResolver.java.txt b/src/test/resources/expected-classes/ProductsByIdsQueryResolver.java.txt index 0827f0ba..7cc4f7de 100644 --- a/src/test/resources/expected-classes/ProductsByIdsQueryResolver.java.txt +++ b/src/test/resources/expected-classes/ProductsByIdsQueryResolver.java.txt @@ -7,6 +7,6 @@ package com.kobylynskyi.graphql.test1; ) public interface ProductsByIdsQueryResolver { - java.util.List products(java.util.List ids) throws Exception; + java.util.List products(@javax.validation.constraints.NotNull java.util.List ids) throws Exception; } \ No newline at end of file diff --git a/src/test/resources/expected-classes/QueryResolver.java.txt b/src/test/resources/expected-classes/QueryResolver.java.txt index 2a41ae2b..ea051111 100644 --- a/src/test/resources/expected-classes/QueryResolver.java.txt +++ b/src/test/resources/expected-classes/QueryResolver.java.txt @@ -17,18 +17,18 @@ public interface QueryResolver { * List of events of a specified category. */ @javax.validation.constraints.NotNull - java.util.List eventsByCategoryAndStatus(String categoryId, EventStatus status) throws Exception; + java.util.List eventsByCategoryAndStatus(@javax.validation.constraints.NotNull String categoryId, EventStatus status) throws Exception; /** * Single event by ID. */ @javax.validation.constraints.NotNull - Event eventById(String id) throws Exception; + Event eventById(@javax.validation.constraints.NotNull String id) throws Exception; /** * Events by IDs. */ @javax.validation.constraints.NotNull - java.util.List eventsByIds(java.util.List ids) throws Exception; + java.util.List eventsByIds(@javax.validation.constraints.NotNull java.util.List ids) throws Exception; } \ No newline at end of file diff --git a/src/test/resources/expected-classes/annotation/CreateEventMutationResolver.java.txt b/src/test/resources/expected-classes/annotation/CreateEventMutationResolver.java.txt index c305ffb2..8647a013 100644 --- a/src/test/resources/expected-classes/annotation/CreateEventMutationResolver.java.txt +++ b/src/test/resources/expected-classes/annotation/CreateEventMutationResolver.java.txt @@ -15,6 +15,6 @@ public interface CreateEventMutationResolver { */ @javax.validation.constraints.NotNull @com.example.CustomAnnotation(roles={"admin", "moderator"}, boo={true, false, true}, float={"12.0", "null"}, int=42, n="null") - Event createEvent(String categoryId, String createdBy) throws Exception; + Event createEvent(@javax.validation.constraints.NotNull @javax.validation.Valid String categoryId, String createdBy) throws Exception; } \ No newline at end of file diff --git a/src/test/resources/expected-classes/annotation/MutationResolver.java.txt b/src/test/resources/expected-classes/annotation/MutationResolver.java.txt index 4487be63..9dce54cb 100644 --- a/src/test/resources/expected-classes/annotation/MutationResolver.java.txt +++ b/src/test/resources/expected-classes/annotation/MutationResolver.java.txt @@ -12,6 +12,6 @@ public interface MutationResolver { */ @javax.validation.constraints.NotNull @com.example.CustomAnnotation(roles={"admin", "moderator"}, boo={true, false, true}, float={"12.0", "null"}, int=42, n="null") - Event createEvent(String categoryId, String createdBy) throws Exception; + Event createEvent(@javax.validation.constraints.NotNull @javax.validation.Valid String categoryId, String createdBy) throws Exception; } \ No newline at end of file diff --git a/src/test/resources/expected-classes/apis/CodeOfConductQueryResolver_withoutThrowsException.java.txt b/src/test/resources/expected-classes/apis/CodeOfConductQueryResolver_withoutThrowsException.java.txt index 0011573d..fddc5493 100644 --- a/src/test/resources/expected-classes/apis/CodeOfConductQueryResolver_withoutThrowsException.java.txt +++ b/src/test/resources/expected-classes/apis/CodeOfConductQueryResolver_withoutThrowsException.java.txt @@ -5,6 +5,6 @@ ) public interface CodeOfConductQueryResolver { - CodeOfConduct codeOfConduct(String key); + CodeOfConduct codeOfConduct(@javax.validation.constraints.NotNull String key); } \ No newline at end of file diff --git a/src/test/resources/expected-classes/apis/MutationResolver_withoutThrowsException.java.txt b/src/test/resources/expected-classes/apis/MutationResolver_withoutThrowsException.java.txt index 62e836de..59427fe8 100644 --- a/src/test/resources/expected-classes/apis/MutationResolver_withoutThrowsException.java.txt +++ b/src/test/resources/expected-classes/apis/MutationResolver_withoutThrowsException.java.txt @@ -5,138 +5,138 @@ ) public interface MutationResolver { - AcceptTopicSuggestionPayload acceptTopicSuggestion(AcceptTopicSuggestionInput input); + AcceptTopicSuggestionPayload acceptTopicSuggestion(@javax.validation.constraints.NotNull AcceptTopicSuggestionInput input); - AddAssigneesToAssignablePayload addAssigneesToAssignable(AddAssigneesToAssignableInput input); + AddAssigneesToAssignablePayload addAssigneesToAssignable(@javax.validation.constraints.NotNull AddAssigneesToAssignableInput input); - AddCommentPayload addComment(AddCommentInput input); + AddCommentPayload addComment(@javax.validation.constraints.NotNull AddCommentInput input); - AddLabelsToLabelablePayload addLabelsToLabelable(AddLabelsToLabelableInput input); + AddLabelsToLabelablePayload addLabelsToLabelable(@javax.validation.constraints.NotNull AddLabelsToLabelableInput input); - AddProjectCardPayload addProjectCard(AddProjectCardInput input); + AddProjectCardPayload addProjectCard(@javax.validation.constraints.NotNull AddProjectCardInput input); - AddProjectColumnPayload addProjectColumn(AddProjectColumnInput input); + AddProjectColumnPayload addProjectColumn(@javax.validation.constraints.NotNull AddProjectColumnInput input); - AddPullRequestReviewPayload addPullRequestReview(AddPullRequestReviewInput input); + AddPullRequestReviewPayload addPullRequestReview(@javax.validation.constraints.NotNull AddPullRequestReviewInput input); - AddPullRequestReviewCommentPayload addPullRequestReviewComment(AddPullRequestReviewCommentInput input); + AddPullRequestReviewCommentPayload addPullRequestReviewComment(@javax.validation.constraints.NotNull AddPullRequestReviewCommentInput input); - AddReactionPayload addReaction(AddReactionInput input); + AddReactionPayload addReaction(@javax.validation.constraints.NotNull AddReactionInput input); - AddStarPayload addStar(AddStarInput input); + AddStarPayload addStar(@javax.validation.constraints.NotNull AddStarInput input); - ChangeUserStatusPayload changeUserStatus(ChangeUserStatusInput input); + ChangeUserStatusPayload changeUserStatus(@javax.validation.constraints.NotNull ChangeUserStatusInput input); - ClearLabelsFromLabelablePayload clearLabelsFromLabelable(ClearLabelsFromLabelableInput input); + ClearLabelsFromLabelablePayload clearLabelsFromLabelable(@javax.validation.constraints.NotNull ClearLabelsFromLabelableInput input); - CloneProjectPayload cloneProject(CloneProjectInput input); + CloneProjectPayload cloneProject(@javax.validation.constraints.NotNull CloneProjectInput input); - CloneTemplateRepositoryPayload cloneTemplateRepository(CloneTemplateRepositoryInput input); + CloneTemplateRepositoryPayload cloneTemplateRepository(@javax.validation.constraints.NotNull CloneTemplateRepositoryInput input); - CloseIssuePayload closeIssue(CloseIssueInput input); + CloseIssuePayload closeIssue(@javax.validation.constraints.NotNull CloseIssueInput input); - ClosePullRequestPayload closePullRequest(ClosePullRequestInput input); + ClosePullRequestPayload closePullRequest(@javax.validation.constraints.NotNull ClosePullRequestInput input); - ConvertProjectCardNoteToIssuePayload convertProjectCardNoteToIssue(ConvertProjectCardNoteToIssueInput input); + ConvertProjectCardNoteToIssuePayload convertProjectCardNoteToIssue(@javax.validation.constraints.NotNull ConvertProjectCardNoteToIssueInput input); - CreateBranchProtectionRulePayload createBranchProtectionRule(CreateBranchProtectionRuleInput input); + CreateBranchProtectionRulePayload createBranchProtectionRule(@javax.validation.constraints.NotNull CreateBranchProtectionRuleInput input); - CreateIssuePayload createIssue(CreateIssueInput input); + CreateIssuePayload createIssue(@javax.validation.constraints.NotNull CreateIssueInput input); - CreateProjectPayload createProject(CreateProjectInput input); + CreateProjectPayload createProject(@javax.validation.constraints.NotNull CreateProjectInput input); - CreatePullRequestPayload createPullRequest(CreatePullRequestInput input); + CreatePullRequestPayload createPullRequest(@javax.validation.constraints.NotNull CreatePullRequestInput input); - CreateRefPayload createRef(CreateRefInput input); + CreateRefPayload createRef(@javax.validation.constraints.NotNull CreateRefInput input); - CreateRepositoryPayload createRepository(CreateRepositoryInput input); + CreateRepositoryPayload createRepository(@javax.validation.constraints.NotNull CreateRepositoryInput input); - DeclineTopicSuggestionPayload declineTopicSuggestion(DeclineTopicSuggestionInput input); + DeclineTopicSuggestionPayload declineTopicSuggestion(@javax.validation.constraints.NotNull DeclineTopicSuggestionInput input); - DeleteBranchProtectionRulePayload deleteBranchProtectionRule(DeleteBranchProtectionRuleInput input); + DeleteBranchProtectionRulePayload deleteBranchProtectionRule(@javax.validation.constraints.NotNull DeleteBranchProtectionRuleInput input); - DeleteIssuePayload deleteIssue(DeleteIssueInput input); + DeleteIssuePayload deleteIssue(@javax.validation.constraints.NotNull DeleteIssueInput input); - DeleteIssueCommentPayload deleteIssueComment(DeleteIssueCommentInput input); + DeleteIssueCommentPayload deleteIssueComment(@javax.validation.constraints.NotNull DeleteIssueCommentInput input); - DeleteProjectPayload deleteProject(DeleteProjectInput input); + DeleteProjectPayload deleteProject(@javax.validation.constraints.NotNull DeleteProjectInput input); - DeleteProjectCardPayload deleteProjectCard(DeleteProjectCardInput input); + DeleteProjectCardPayload deleteProjectCard(@javax.validation.constraints.NotNull DeleteProjectCardInput input); - DeleteProjectColumnPayload deleteProjectColumn(DeleteProjectColumnInput input); + DeleteProjectColumnPayload deleteProjectColumn(@javax.validation.constraints.NotNull DeleteProjectColumnInput input); - DeletePullRequestReviewPayload deletePullRequestReview(DeletePullRequestReviewInput input); + DeletePullRequestReviewPayload deletePullRequestReview(@javax.validation.constraints.NotNull DeletePullRequestReviewInput input); - DeletePullRequestReviewCommentPayload deletePullRequestReviewComment(DeletePullRequestReviewCommentInput input); + DeletePullRequestReviewCommentPayload deletePullRequestReviewComment(@javax.validation.constraints.NotNull DeletePullRequestReviewCommentInput input); - DeleteRefPayload deleteRef(DeleteRefInput input); + DeleteRefPayload deleteRef(@javax.validation.constraints.NotNull DeleteRefInput input); - DismissPullRequestReviewPayload dismissPullRequestReview(DismissPullRequestReviewInput input); + DismissPullRequestReviewPayload dismissPullRequestReview(@javax.validation.constraints.NotNull DismissPullRequestReviewInput input); - LinkRepositoryToProjectPayload linkRepositoryToProject(LinkRepositoryToProjectInput input); + LinkRepositoryToProjectPayload linkRepositoryToProject(@javax.validation.constraints.NotNull LinkRepositoryToProjectInput input); - LockLockablePayload lockLockable(LockLockableInput input); + LockLockablePayload lockLockable(@javax.validation.constraints.NotNull LockLockableInput input); - MergeBranchPayload mergeBranch(MergeBranchInput input); + MergeBranchPayload mergeBranch(@javax.validation.constraints.NotNull MergeBranchInput input); - MergePullRequestPayload mergePullRequest(MergePullRequestInput input); + MergePullRequestPayload mergePullRequest(@javax.validation.constraints.NotNull MergePullRequestInput input); - MoveProjectCardPayload moveProjectCard(MoveProjectCardInput input); + MoveProjectCardPayload moveProjectCard(@javax.validation.constraints.NotNull MoveProjectCardInput input); - MoveProjectColumnPayload moveProjectColumn(MoveProjectColumnInput input); + MoveProjectColumnPayload moveProjectColumn(@javax.validation.constraints.NotNull MoveProjectColumnInput input); - RemoveAssigneesFromAssignablePayload removeAssigneesFromAssignable(RemoveAssigneesFromAssignableInput input); + RemoveAssigneesFromAssignablePayload removeAssigneesFromAssignable(@javax.validation.constraints.NotNull RemoveAssigneesFromAssignableInput input); - RemoveLabelsFromLabelablePayload removeLabelsFromLabelable(RemoveLabelsFromLabelableInput input); + RemoveLabelsFromLabelablePayload removeLabelsFromLabelable(@javax.validation.constraints.NotNull RemoveLabelsFromLabelableInput input); - RemoveOutsideCollaboratorPayload removeOutsideCollaborator(RemoveOutsideCollaboratorInput input); + RemoveOutsideCollaboratorPayload removeOutsideCollaborator(@javax.validation.constraints.NotNull RemoveOutsideCollaboratorInput input); - RemoveReactionPayload removeReaction(RemoveReactionInput input); + RemoveReactionPayload removeReaction(@javax.validation.constraints.NotNull RemoveReactionInput input); - RemoveStarPayload removeStar(RemoveStarInput input); + RemoveStarPayload removeStar(@javax.validation.constraints.NotNull RemoveStarInput input); - ReopenIssuePayload reopenIssue(ReopenIssueInput input); + ReopenIssuePayload reopenIssue(@javax.validation.constraints.NotNull ReopenIssueInput input); - ReopenPullRequestPayload reopenPullRequest(ReopenPullRequestInput input); + ReopenPullRequestPayload reopenPullRequest(@javax.validation.constraints.NotNull ReopenPullRequestInput input); - RequestReviewsPayload requestReviews(RequestReviewsInput input); + RequestReviewsPayload requestReviews(@javax.validation.constraints.NotNull RequestReviewsInput input); - ResolveReviewThreadPayload resolveReviewThread(ResolveReviewThreadInput input); + ResolveReviewThreadPayload resolveReviewThread(@javax.validation.constraints.NotNull ResolveReviewThreadInput input); - SubmitPullRequestReviewPayload submitPullRequestReview(SubmitPullRequestReviewInput input); + SubmitPullRequestReviewPayload submitPullRequestReview(@javax.validation.constraints.NotNull SubmitPullRequestReviewInput input); - UnlinkRepositoryFromProjectPayload unlinkRepositoryFromProject(UnlinkRepositoryFromProjectInput input); + UnlinkRepositoryFromProjectPayload unlinkRepositoryFromProject(@javax.validation.constraints.NotNull UnlinkRepositoryFromProjectInput input); - UnlockLockablePayload unlockLockable(UnlockLockableInput input); + UnlockLockablePayload unlockLockable(@javax.validation.constraints.NotNull UnlockLockableInput input); - UnmarkIssueAsDuplicatePayload unmarkIssueAsDuplicate(UnmarkIssueAsDuplicateInput input); + UnmarkIssueAsDuplicatePayload unmarkIssueAsDuplicate(@javax.validation.constraints.NotNull UnmarkIssueAsDuplicateInput input); - UnresolveReviewThreadPayload unresolveReviewThread(UnresolveReviewThreadInput input); + UnresolveReviewThreadPayload unresolveReviewThread(@javax.validation.constraints.NotNull UnresolveReviewThreadInput input); - UpdateBranchProtectionRulePayload updateBranchProtectionRule(UpdateBranchProtectionRuleInput input); + UpdateBranchProtectionRulePayload updateBranchProtectionRule(@javax.validation.constraints.NotNull UpdateBranchProtectionRuleInput input); - UpdateIssuePayload updateIssue(UpdateIssueInput input); + UpdateIssuePayload updateIssue(@javax.validation.constraints.NotNull UpdateIssueInput input); - UpdateIssueCommentPayload updateIssueComment(UpdateIssueCommentInput input); + UpdateIssueCommentPayload updateIssueComment(@javax.validation.constraints.NotNull UpdateIssueCommentInput input); - UpdateProjectPayload updateProject(UpdateProjectInput input); + UpdateProjectPayload updateProject(@javax.validation.constraints.NotNull UpdateProjectInput input); - UpdateProjectCardPayload updateProjectCard(UpdateProjectCardInput input); + UpdateProjectCardPayload updateProjectCard(@javax.validation.constraints.NotNull UpdateProjectCardInput input); - UpdateProjectColumnPayload updateProjectColumn(UpdateProjectColumnInput input); + UpdateProjectColumnPayload updateProjectColumn(@javax.validation.constraints.NotNull UpdateProjectColumnInput input); - UpdatePullRequestPayload updatePullRequest(UpdatePullRequestInput input); + UpdatePullRequestPayload updatePullRequest(@javax.validation.constraints.NotNull UpdatePullRequestInput input); - UpdatePullRequestReviewPayload updatePullRequestReview(UpdatePullRequestReviewInput input); + UpdatePullRequestReviewPayload updatePullRequestReview(@javax.validation.constraints.NotNull UpdatePullRequestReviewInput input); - UpdatePullRequestReviewCommentPayload updatePullRequestReviewComment(UpdatePullRequestReviewCommentInput input); + UpdatePullRequestReviewCommentPayload updatePullRequestReviewComment(@javax.validation.constraints.NotNull UpdatePullRequestReviewCommentInput input); - UpdateRefPayload updateRef(UpdateRefInput input); + UpdateRefPayload updateRef(@javax.validation.constraints.NotNull UpdateRefInput input); - UpdateRepositoryPayload updateRepository(UpdateRepositoryInput input); + UpdateRepositoryPayload updateRepository(@javax.validation.constraints.NotNull UpdateRepositoryInput input); - UpdateSubscriptionPayload updateSubscription(UpdateSubscriptionInput input); + UpdateSubscriptionPayload updateSubscription(@javax.validation.constraints.NotNull UpdateSubscriptionInput input); - UpdateTopicsPayload updateTopics(UpdateTopicsInput input); + UpdateTopicsPayload updateTopics(@javax.validation.constraints.NotNull UpdateTopicsInput input); } \ No newline at end of file diff --git a/src/test/resources/expected-classes/deprecated/CreateEventMutationResolver.java.txt b/src/test/resources/expected-classes/deprecated/CreateEventMutationResolver.java.txt index 7b59a7a7..cb588ae6 100644 --- a/src/test/resources/expected-classes/deprecated/CreateEventMutationResolver.java.txt +++ b/src/test/resources/expected-classes/deprecated/CreateEventMutationResolver.java.txt @@ -9,6 +9,6 @@ public interface CreateEventMutationResolver { @Deprecated @javax.validation.constraints.NotNull - Event createEvent(EventInput input) throws Exception; + Event createEvent(@javax.validation.constraints.NotNull EventInput input) throws Exception; } \ No newline at end of file diff --git a/src/test/resources/expected-classes/deprecated/MutationResolver.java.txt b/src/test/resources/expected-classes/deprecated/MutationResolver.java.txt index 4d6e79a4..53b97636 100644 --- a/src/test/resources/expected-classes/deprecated/MutationResolver.java.txt +++ b/src/test/resources/expected-classes/deprecated/MutationResolver.java.txt @@ -9,6 +9,6 @@ public interface MutationResolver { @Deprecated @javax.validation.constraints.NotNull - Event createEvent(EventInput input) throws Exception; + Event createEvent(@javax.validation.constraints.NotNull EventInput input) throws Exception; } \ No newline at end of file diff --git a/src/test/resources/expected-classes/extend-with-resolvers/CreateAssetMutationResolver.java.txt b/src/test/resources/expected-classes/extend-with-resolvers/CreateAssetMutationResolver.java.txt index f41c58f7..87c4e041 100644 --- a/src/test/resources/expected-classes/extend-with-resolvers/CreateAssetMutationResolver.java.txt +++ b/src/test/resources/expected-classes/extend-with-resolvers/CreateAssetMutationResolver.java.txt @@ -5,6 +5,6 @@ public interface CreateAssetMutationResolver { @javax.validation.constraints.NotNull - Asset createAsset(AssetInput input) throws Exception; + Asset createAsset(@javax.validation.constraints.NotNull AssetInput input) throws Exception; } \ No newline at end of file diff --git a/src/test/resources/expected-classes/extend-with-resolvers/CreateEventMutationResolver.java.txt b/src/test/resources/expected-classes/extend-with-resolvers/CreateEventMutationResolver.java.txt index 87a4c86a..79ae9115 100644 --- a/src/test/resources/expected-classes/extend-with-resolvers/CreateEventMutationResolver.java.txt +++ b/src/test/resources/expected-classes/extend-with-resolvers/CreateEventMutationResolver.java.txt @@ -5,6 +5,6 @@ public interface CreateEventMutationResolver { @javax.validation.constraints.NotNull - Event createEvent(EventInput input) throws Exception; + Event createEvent(@javax.validation.constraints.NotNull EventInput input) throws Exception; } \ No newline at end of file diff --git a/src/test/resources/expected-classes/extend-with-resolvers/MutationResolver.java.txt b/src/test/resources/expected-classes/extend-with-resolvers/MutationResolver.java.txt index 8e08e64e..7651fa41 100644 --- a/src/test/resources/expected-classes/extend-with-resolvers/MutationResolver.java.txt +++ b/src/test/resources/expected-classes/extend-with-resolvers/MutationResolver.java.txt @@ -5,9 +5,9 @@ public interface MutationResolver { @javax.validation.constraints.NotNull - Event createEvent(EventInput input) throws Exception; + Event createEvent(@javax.validation.constraints.NotNull EventInput input) throws Exception; @javax.validation.constraints.NotNull - Asset createAsset(AssetInput input) throws Exception; + Asset createAsset(@javax.validation.constraints.NotNull AssetInput input) throws Exception; } \ No newline at end of file diff --git a/src/test/resources/expected-classes/extend/CreateAssetMutationResolver.java.txt b/src/test/resources/expected-classes/extend/CreateAssetMutationResolver.java.txt index f41c58f7..87c4e041 100644 --- a/src/test/resources/expected-classes/extend/CreateAssetMutationResolver.java.txt +++ b/src/test/resources/expected-classes/extend/CreateAssetMutationResolver.java.txt @@ -5,6 +5,6 @@ public interface CreateAssetMutationResolver { @javax.validation.constraints.NotNull - Asset createAsset(AssetInput input) throws Exception; + Asset createAsset(@javax.validation.constraints.NotNull AssetInput input) throws Exception; } \ No newline at end of file diff --git a/src/test/resources/expected-classes/extend/CreateEventMutationResolver.java.txt b/src/test/resources/expected-classes/extend/CreateEventMutationResolver.java.txt index 87a4c86a..79ae9115 100644 --- a/src/test/resources/expected-classes/extend/CreateEventMutationResolver.java.txt +++ b/src/test/resources/expected-classes/extend/CreateEventMutationResolver.java.txt @@ -5,6 +5,6 @@ public interface CreateEventMutationResolver { @javax.validation.constraints.NotNull - Event createEvent(EventInput input) throws Exception; + Event createEvent(@javax.validation.constraints.NotNull EventInput input) throws Exception; } \ No newline at end of file diff --git a/src/test/resources/expected-classes/extend/MutationResolver.java.txt b/src/test/resources/expected-classes/extend/MutationResolver.java.txt index 8e08e64e..7651fa41 100644 --- a/src/test/resources/expected-classes/extend/MutationResolver.java.txt +++ b/src/test/resources/expected-classes/extend/MutationResolver.java.txt @@ -5,9 +5,9 @@ public interface MutationResolver { @javax.validation.constraints.NotNull - Event createEvent(EventInput input) throws Exception; + Event createEvent(@javax.validation.constraints.NotNull EventInput input) throws Exception; @javax.validation.constraints.NotNull - Asset createAsset(AssetInput input) throws Exception; + Asset createAsset(@javax.validation.constraints.NotNull AssetInput input) throws Exception; } \ No newline at end of file diff --git a/src/test/resources/expected-classes/from-introspection-result/CreateMutationResolver.java.txt b/src/test/resources/expected-classes/from-introspection-result/CreateMutationResolver.java.txt index 30db736e..93db7516 100644 --- a/src/test/resources/expected-classes/from-introspection-result/CreateMutationResolver.java.txt +++ b/src/test/resources/expected-classes/from-introspection-result/CreateMutationResolver.java.txt @@ -7,6 +7,6 @@ package com.kobylynskyi.graphql.test1; ) public interface CreateMutationResolver { - Product create(ProductInput productInput) throws Exception; + Product create(@javax.validation.constraints.NotNull ProductInput productInput) throws Exception; } \ No newline at end of file diff --git a/src/test/resources/expected-classes/from-introspection-result/MutationResolver.java.txt b/src/test/resources/expected-classes/from-introspection-result/MutationResolver.java.txt index cb7d0d57..ffa19570 100644 --- a/src/test/resources/expected-classes/from-introspection-result/MutationResolver.java.txt +++ b/src/test/resources/expected-classes/from-introspection-result/MutationResolver.java.txt @@ -7,6 +7,6 @@ package com.kobylynskyi.graphql.test1; ) public interface MutationResolver { - Product create(ProductInput productInput) throws Exception; + Product create(@javax.validation.constraints.NotNull ProductInput productInput) throws Exception; } \ No newline at end of file diff --git a/src/test/resources/expected-classes/from-introspection-result/ProductByIdQueryResolver.java.txt b/src/test/resources/expected-classes/from-introspection-result/ProductByIdQueryResolver.java.txt index ec71104b..afb75aeb 100644 --- a/src/test/resources/expected-classes/from-introspection-result/ProductByIdQueryResolver.java.txt +++ b/src/test/resources/expected-classes/from-introspection-result/ProductByIdQueryResolver.java.txt @@ -7,6 +7,6 @@ package com.kobylynskyi.graphql.test1; ) public interface ProductByIdQueryResolver { - Product productById(String id) throws Exception; + Product productById(@javax.validation.constraints.NotNull String id) throws Exception; } \ No newline at end of file diff --git a/src/test/resources/expected-classes/from-introspection-result/ProductsByIdsQueryResolver.java.txt b/src/test/resources/expected-classes/from-introspection-result/ProductsByIdsQueryResolver.java.txt index 43ff84d9..8ba04d9a 100644 --- a/src/test/resources/expected-classes/from-introspection-result/ProductsByIdsQueryResolver.java.txt +++ b/src/test/resources/expected-classes/from-introspection-result/ProductsByIdsQueryResolver.java.txt @@ -7,6 +7,6 @@ package com.kobylynskyi.graphql.test1; ) public interface ProductsByIdsQueryResolver { - java.util.List productsByIds(java.util.List ids) throws Exception; + java.util.List productsByIds(@javax.validation.constraints.NotNull java.util.List ids) throws Exception; } \ No newline at end of file diff --git a/src/test/resources/expected-classes/from-introspection-result/QueryResolver.java.txt b/src/test/resources/expected-classes/from-introspection-result/QueryResolver.java.txt index 9632c41f..7f411673 100644 --- a/src/test/resources/expected-classes/from-introspection-result/QueryResolver.java.txt +++ b/src/test/resources/expected-classes/from-introspection-result/QueryResolver.java.txt @@ -9,8 +9,8 @@ public interface QueryResolver { java.util.List products() throws Exception; - Product productById(String id) throws Exception; + Product productById(@javax.validation.constraints.NotNull String id) throws Exception; - java.util.List productsByIds(java.util.List ids) throws Exception; + java.util.List productsByIds(@javax.validation.constraints.NotNull java.util.List ids) throws Exception; } \ No newline at end of file diff --git a/src/test/resources/expected-classes/optional/NodeQueryResolver.java.txt b/src/test/resources/expected-classes/optional/NodeQueryResolver.java.txt index 4b30798d..b8072774 100644 --- a/src/test/resources/expected-classes/optional/NodeQueryResolver.java.txt +++ b/src/test/resources/expected-classes/optional/NodeQueryResolver.java.txt @@ -5,6 +5,6 @@ ) public interface NodeQueryResolver { - java.util.Optional node(String id) throws Exception; + java.util.Optional node(@javax.validation.constraints.NotNull String id) throws Exception; } \ No newline at end of file diff --git a/src/test/resources/expected-classes/optional/NodeQueryResolver_mono.java.txt b/src/test/resources/expected-classes/optional/NodeQueryResolver_mono.java.txt index 0af0f745..c19f308b 100644 --- a/src/test/resources/expected-classes/optional/NodeQueryResolver_mono.java.txt +++ b/src/test/resources/expected-classes/optional/NodeQueryResolver_mono.java.txt @@ -5,6 +5,6 @@ ) public interface NodeQueryResolver { - reactor.core.publisher.Mono> node(String id) throws Exception; + reactor.core.publisher.Mono> node(@javax.validation.constraints.NotNull String id) throws Exception; } \ No newline at end of file diff --git a/src/test/resources/expected-classes/optional/NodesQueryResolver.java.txt b/src/test/resources/expected-classes/optional/NodesQueryResolver.java.txt index cf2b5230..4cfa92c3 100644 --- a/src/test/resources/expected-classes/optional/NodesQueryResolver.java.txt +++ b/src/test/resources/expected-classes/optional/NodesQueryResolver.java.txt @@ -6,6 +6,6 @@ public interface NodesQueryResolver { @javax.validation.constraints.NotNull - java.util.List nodes(java.util.List ids) throws Exception; + java.util.List nodes(@javax.validation.constraints.NotNull java.util.List ids) throws Exception; } \ No newline at end of file diff --git a/src/test/resources/expected-classes/optional/QueryResolver.java.txt b/src/test/resources/expected-classes/optional/QueryResolver.java.txt index 0d5b5ad8..c43ce520 100644 --- a/src/test/resources/expected-classes/optional/QueryResolver.java.txt +++ b/src/test/resources/expected-classes/optional/QueryResolver.java.txt @@ -4,21 +4,21 @@ ) public interface QueryResolver { - java.util.Optional codeOfConduct(String key) throws Exception; + java.util.Optional codeOfConduct(@javax.validation.constraints.NotNull String key) throws Exception; java.util.List codesOfConduct() throws Exception; - java.util.Optional license(String key) throws Exception; + java.util.Optional license(@javax.validation.constraints.NotNull String key) throws Exception; @javax.validation.constraints.NotNull java.util.List licenses() throws Exception; @javax.validation.constraints.NotNull - java.util.List marketplaceCategories(Boolean excludeEmpty, Boolean excludeSubcategories, java.util.List includeCategories) throws Exception; + java.util.List marketplaceCategories(Boolean excludeEmpty, Boolean excludeSubcategories, @javax.validation.constraints.NotNull java.util.List includeCategories) throws Exception; - java.util.Optional marketplaceCategory(String slug, Boolean useTopicAliases) throws Exception; + java.util.Optional marketplaceCategory(@javax.validation.constraints.NotNull String slug, Boolean useTopicAliases) throws Exception; - java.util.Optional marketplaceListing(String slug) throws Exception; + java.util.Optional marketplaceListing(@javax.validation.constraints.NotNull String slug) throws Exception; @javax.validation.constraints.NotNull MarketplaceListingConnection marketplaceListings(String adminId, String after, Boolean allStates, String before, String categorySlug, Integer first, Integer last, String organizationId, Boolean primaryCategoryOnly, java.util.List slugs, Boolean useTopicAliases, Boolean viewerCanAdmin, Boolean withFreeTrialsOnly) throws Exception; @@ -26,40 +26,40 @@ public interface QueryResolver { @javax.validation.constraints.NotNull GitHubMetadata meta() throws Exception; - java.util.Optional node(String id) throws Exception; + java.util.Optional node(@javax.validation.constraints.NotNull String id) throws Exception; @javax.validation.constraints.NotNull - java.util.List nodes(java.util.List ids) throws Exception; + java.util.List nodes(@javax.validation.constraints.NotNull java.util.List ids) throws Exception; - java.util.Optional organization(String login) throws Exception; + java.util.Optional organization(@javax.validation.constraints.NotNull String login) throws Exception; java.util.Optional rateLimit(Boolean dryRun) throws Exception; @javax.validation.constraints.NotNull Query relay() throws Exception; - java.util.Optional repository(String name, String owner) throws Exception; + java.util.Optional repository(@javax.validation.constraints.NotNull String name, @javax.validation.constraints.NotNull String owner) throws Exception; - java.util.Optional repositoryOwner(String login) throws Exception; + java.util.Optional repositoryOwner(@javax.validation.constraints.NotNull String login) throws Exception; - java.util.Optional resource(String url) throws Exception; + java.util.Optional resource(@javax.validation.constraints.NotNull String url) throws Exception; @javax.validation.constraints.NotNull - SearchResultItemConnection search(String after, String before, Integer first, Integer last, String query, SearchType type) throws Exception; + SearchResultItemConnection search(String after, String before, Integer first, Integer last, @javax.validation.constraints.NotNull String query, @javax.validation.constraints.NotNull SearchType type) throws Exception; @javax.validation.constraints.NotNull SecurityAdvisoryConnection securityAdvisories(String after, String before, Integer first, SecurityAdvisoryIdentifierFilter identifier, Integer last, SecurityAdvisoryOrder orderBy, String publishedSince, String updatedSince) throws Exception; - java.util.Optional securityAdvisory(String ghsaId) throws Exception; + java.util.Optional securityAdvisory(@javax.validation.constraints.NotNull String ghsaId) throws Exception; @javax.validation.constraints.NotNull - SecurityVulnerabilityConnection securityVulnerabilities(String after, String before, SecurityAdvisoryEcosystem ecosystem, Integer first, Integer last, SecurityVulnerabilityOrder orderBy, String Package, java.util.List severities) throws Exception; + SecurityVulnerabilityConnection securityVulnerabilities(String after, String before, SecurityAdvisoryEcosystem ecosystem, Integer first, Integer last, SecurityVulnerabilityOrder orderBy, String Package, @javax.validation.constraints.NotNull java.util.List severities) throws Exception; - java.util.Optional sponsorsListing(String slug) throws Exception; + java.util.Optional sponsorsListing(@javax.validation.constraints.NotNull String slug) throws Exception; - java.util.Optional topic(String name) throws Exception; + java.util.Optional topic(@javax.validation.constraints.NotNull String name) throws Exception; - java.util.Optional user(String login) throws Exception; + java.util.Optional user(@javax.validation.constraints.NotNull String login) throws Exception; @javax.validation.constraints.NotNull User viewer() throws Exception; diff --git a/src/test/resources/expected-classes/parent-interfaces/CreateEventMutationResolver.java.txt b/src/test/resources/expected-classes/parent-interfaces/CreateEventMutationResolver.java.txt index 635f80dd..6050ec7f 100644 --- a/src/test/resources/expected-classes/parent-interfaces/CreateEventMutationResolver.java.txt +++ b/src/test/resources/expected-classes/parent-interfaces/CreateEventMutationResolver.java.txt @@ -14,6 +14,6 @@ public interface CreateEventMutationResolver extends graphql.kickstart.tools.Gra * Create a new event. */ @javax.validation.constraints.NotNull - EventTO createEvent(String categoryId, String createdBy) throws Exception; + EventTO createEvent(@javax.validation.constraints.NotNull String categoryId, String createdBy) throws Exception; } \ No newline at end of file diff --git a/src/test/resources/expected-classes/parent-interfaces/MutationResolver.java.txt b/src/test/resources/expected-classes/parent-interfaces/MutationResolver.java.txt index 5705955a..5be24f3a 100644 --- a/src/test/resources/expected-classes/parent-interfaces/MutationResolver.java.txt +++ b/src/test/resources/expected-classes/parent-interfaces/MutationResolver.java.txt @@ -11,6 +11,6 @@ public interface MutationResolver extends graphql.kickstart.tools.GraphQLMutatio * Create a new event. */ @javax.validation.constraints.NotNull - EventTO createEvent(String categoryId, String createdBy) throws Exception; + EventTO createEvent(@javax.validation.constraints.NotNull String categoryId, String createdBy) throws Exception; } \ No newline at end of file diff --git a/src/test/resources/expected-classes/parent-interfaces/QueryResolver.java.txt b/src/test/resources/expected-classes/parent-interfaces/QueryResolver.java.txt index 1520e3d0..05c1d5ef 100644 --- a/src/test/resources/expected-classes/parent-interfaces/QueryResolver.java.txt +++ b/src/test/resources/expected-classes/parent-interfaces/QueryResolver.java.txt @@ -17,18 +17,18 @@ public interface QueryResolver extends graphql.kickstart.tools.GraphQLQueryResol * List of events of a specified category. */ @javax.validation.constraints.NotNull - java.util.List eventsByCategoryAndStatus(String categoryId, EventStatusTO status) throws Exception; + java.util.List eventsByCategoryAndStatus(@javax.validation.constraints.NotNull String categoryId, EventStatusTO status) throws Exception; /** * Single event by ID. */ @javax.validation.constraints.NotNull - EventTO eventById(String id) throws Exception; + EventTO eventById(@javax.validation.constraints.NotNull String id) throws Exception; /** * Events by IDs. */ @javax.validation.constraints.NotNull - java.util.List eventsByIds(java.util.List ids) throws Exception; + java.util.List eventsByIds(@javax.validation.constraints.NotNull java.util.List ids) throws Exception; } \ No newline at end of file diff --git a/src/test/resources/schemas/test.graphqls b/src/test/resources/schemas/test.graphqls index 6ec6e763..2615eb1e 100644 --- a/src/test/resources/schemas/test.graphqls +++ b/src/test/resources/schemas/test.graphqls @@ -28,7 +28,7 @@ type Query { type Mutation { # Create a new event. - createEvent(categoryId: String!, createdBy: String!): Event! + createEvent(categoryId: String! @valid, createdBy: String): Event! @auth( roles: ["admin", "moderator"], boo: [true, false, true], @@ -105,3 +105,4 @@ directive @auth ( directive @customResolver on FIELD_DEFINITION | OBJECT directive @noResolver on FIELD_DEFINITION | OBJECT +directive @valid on ARGUMENT_DEFINITION -- GitLab