Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public interface ${className}<#if implements?has_content> extends <#list impleme
<#list operation.annotations as annotation>
@${annotation}
</#list>
${operation.type} ${operation.name}(<#list operation.parameters as param>${param.type} ${param.name}<#if param_has_next>, </#if></#list>)<#if operation.throwsException> throws Exception</#if>;
${operation.type} ${operation.name}(<#list operation.parameters as param><#list param.annotations as paramAnnotation>@${paramAnnotation}<#if param.annotations?has_content> </#if></#list>${param.type} ${param.name}<#if param_has_next>, </#if></#list>)<#if operation.throwsException> throws Exception</#if>;

</#list>
}
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ void generate_Directives() throws Exception {
"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"),
Expand Down
4 changes: 2 additions & 2 deletions src/test/resources/expected-classes/CommitResolver.java.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> 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<String> 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ public interface EventsByCategoryAndStatusQueryResolver {
* List of events of a specified category.
*/
@javax.validation.constraints.NotNull
java.util.List<Event> eventsByCategoryAndStatus(String categoryId, EventStatus status) throws Exception;
java.util.List<Event> eventsByCategoryAndStatus(@javax.validation.constraints.NotNull String categoryId, EventStatus status) throws Exception;

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ public interface EventsByIdsQueryResolver {
* Events by IDs.
*/
@javax.validation.constraints.NotNull
java.util.List<Event> eventsByIds(java.util.List<String> ids) throws Exception;
java.util.List<Event> eventsByIds(@javax.validation.constraints.NotNull java.util.List<String> ids) throws Exception;

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ package com.kobylynskyi.graphql.test1;
)
public interface ProductsByCategoryIdAndStatusQueryResolver {

java.util.List<Product> products(String categoryId, String status) throws Exception;
java.util.List<Product> products(@javax.validation.constraints.NotNull String categoryId, @javax.validation.constraints.NotNull String status) throws Exception;

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ package com.kobylynskyi.graphql.test1;
)
public interface ProductsByIdsQueryResolver {

java.util.List<Product> products(java.util.List<String> ids) throws Exception;
java.util.List<Product> products(@javax.validation.constraints.NotNull java.util.List<String> ids) throws Exception;

}
6 changes: 3 additions & 3 deletions src/test/resources/expected-classes/QueryResolver.java.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ public interface QueryResolver {
* List of events of a specified category.
*/
@javax.validation.constraints.NotNull
java.util.List<Event> eventsByCategoryAndStatus(String categoryId, EventStatus status) throws Exception;
java.util.List<Event> 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<Event> eventsByIds(java.util.List<String> ids) throws Exception;
java.util.List<Event> eventsByIds(@javax.validation.constraints.NotNull java.util.List<String> ids) throws Exception;

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
)
public interface CodeOfConductQueryResolver {

CodeOfConduct codeOfConduct(String key);
CodeOfConduct codeOfConduct(@javax.validation.constraints.NotNull String key);

}
Loading