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
2 changes: 1 addition & 1 deletion plugins/maven/graphql-java-codegen-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<developerConnection>scm:git:[email protected]:kobylynskyi/graphql-java-codegen.git
</developerConnection>
<url>https://github.com/kobylynskyi/graphql-java-codegen/tree/master/plugins/maven</url>
<tag>v5.3.0</tag>
<tag>HEAD</tag>
</scm>

<distributionManagement>
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/templates/java-lang/type.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ import java.util.StringJoiner;
</#list>
public class ${className} implements java.io.Serializable<#if implements?has_content><#list implements as interface>, ${interface}<#if interface_has_next></#if></#list></#if> {

private static final long serialVersionUID = 1L;
Copy link
Collaborator

Choose a reason for hiding this comment

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

welcome to create pr.
I only have one questions.

  1. The library is based on 1.8, and the annotation comes from Java 11.

So It is not appropriate to introduce this annotation directly. With configuration, placeholders can be more generic for compatibility with Java 1.8 and other languages.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yes, I removed the annotation. It is not really needed anyway

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi,
Is there any update on this issue?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe we can check the JDK version in the template.

<#assign MapperUtil=statics["com.kobylynskyi.graphql.codegen.java.Utils"]>

and <# if checkJdk /> ? @kobylynskyi

Copy link
Owner

Choose a reason for hiding this comment

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

I don't think we need that annotation anyway.
Sorry for a long delay in reply!


<#if fields?has_content>
<#list fields as field>
<#if field.deprecated?has_content>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ package com.github.graphql;
)
public class CommentDeletedEvent implements java.io.Serializable, IssueTimelineItems, PullRequestTimelineItems, Node {

private static final long serialVersionUID = 1L;

@javax.validation.constraints.NotNull
private String id;

Expand Down Expand Up @@ -48,4 +50,4 @@ public class CommentDeletedEvent implements java.io.Serializable, IssueTimelineI
}

}
}
}
4 changes: 3 additions & 1 deletion src/test/resources/expected-classes/Commit.java.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ package com.github.graphql;
)
public class Commit implements java.io.Serializable, Closer, IssueTimelineItem, PullRequestTimelineItem, Subscribable, Node, GitObject, UniformResourceLocatable {

private static final long serialVersionUID = 1L;

@javax.validation.constraints.NotNull
private String abbreviatedOid;
private int additions;
Expand Down Expand Up @@ -626,4 +628,4 @@ public class Commit implements java.io.Serializable, Closer, IssueTimelineItem,
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ package com.github.graphql;
)
public class Commit implements java.io.Serializable, Closer, IssueTimelineItem, PullRequestTimelineItem, Subscribable, Node, GitObject, UniformResourceLocatable {

private static final long serialVersionUID = 1L;

@javax.validation.constraints.NotNull
private String abbreviatedOid;
private int additions;
Expand Down Expand Up @@ -532,4 +534,4 @@ public class Commit implements java.io.Serializable, Closer, IssueTimelineItem,
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ package com.github.graphql;
)
public class Commit implements java.io.Serializable, Closer, IssueTimelineItem, PullRequestTimelineItem, Subscribable, Node, GitObject, UniformResourceLocatable {

private static final long serialVersionUID = 1L;

private String abbreviatedOid;
private int additions;
private PullRequestConnection associatedPullRequests;
Expand Down Expand Up @@ -602,4 +604,4 @@ public class Commit implements java.io.Serializable, Closer, IssueTimelineItem,
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ package com.github.graphql;
)
public class Commit implements java.io.Serializable, Closer, IssueTimelineItem, PullRequestTimelineItem, Subscribable, Node, GitObject, UniformResourceLocatable {

private static final long serialVersionUID = 1L;

@javax.validation.constraints.NotNull
private String abbreviatedOid;
@javax.validation.constraints.NotNull
Expand Down Expand Up @@ -632,4 +634,4 @@ public class Commit implements java.io.Serializable, Closer, IssueTimelineItem,
}

}
}
}
4 changes: 3 additions & 1 deletion src/test/resources/expected-classes/Event.java.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ package com.kobylynskyi.graphql.test1;
)
public class Event implements java.io.Serializable {

private static final long serialVersionUID = 1L;

private String id;
private String categoryId;
private java.util.List<EventProperty> properties;
Expand Down Expand Up @@ -155,4 +157,4 @@ public class Event implements java.io.Serializable {
}

}
}
}
4 changes: 3 additions & 1 deletion src/test/resources/expected-classes/EventProperty.java.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ package com.kobylynskyi.graphql.test1;
)
public class EventProperty implements java.io.Serializable {

private static final long serialVersionUID = 1L;

private Double floatVal;
private Boolean booleanVal;
private int intVal;
Expand Down Expand Up @@ -188,4 +190,4 @@ public class EventProperty implements java.io.Serializable {
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import java.util.StringJoiner;
)
public class EventPropertyTO implements java.io.Serializable {

private static final long serialVersionUID = 1L;

private Double floatVal;
private Boolean booleanVal;
private int intVal;
Expand Down Expand Up @@ -213,4 +215,4 @@ public class EventPropertyTO implements java.io.Serializable {
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import java.util.Objects;
)
public class EventPropertyTO implements java.io.Serializable {

private static final long serialVersionUID = 1L;

private Double floatVal;
private Boolean booleanVal;
private int intVal;
Expand Down Expand Up @@ -211,4 +213,4 @@ public class EventPropertyTO implements java.io.Serializable {
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ package com.kobylynskyi.graphql.test1;
*/
public class EventPropertyTO implements java.io.Serializable {

private static final long serialVersionUID = 1L;

private Double floatVal;
private Boolean booleanVal;
private int intVal;
Expand Down
4 changes: 3 additions & 1 deletion src/test/resources/expected-classes/Event_noBuilder.java.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ package com.kobylynskyi.graphql.test1;
)
public class Event implements java.io.Serializable {

private static final long serialVersionUID = 1L;

private String id;
private String categoryId;
private java.util.List<EventProperty> properties;
Expand Down Expand Up @@ -91,4 +93,4 @@ public class Event implements java.io.Serializable {



}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ package com.github.graphql;
)
public class GithubAcceptTopicSuggestionInputTO implements java.io.Serializable {

private static final long serialVersionUID = 1L;

private String clientMutationId;
@javax.validation.constraints.NotNull
private String name;
Expand Down Expand Up @@ -79,4 +81,4 @@ public class GithubAcceptTopicSuggestionInputTO implements java.io.Serializable
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ package com.github.graphql;
)
public class GithubAcceptTopicSuggestionPayloadTO implements java.io.Serializable {

private static final long serialVersionUID = 1L;

private String clientMutationId;

public GithubAcceptTopicSuggestionPayloadTO() {
Expand Down Expand Up @@ -47,4 +49,4 @@ public class GithubAcceptTopicSuggestionPayloadTO implements java.io.Serializabl
}

}
}
}
4 changes: 3 additions & 1 deletion src/test/resources/expected-classes/GithubCommitTO.java.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ package com.github.graphql;
)
public class GithubCommitTO implements java.io.Serializable, GithubCloserTO, GithubIssueTimelineItemTO, GithubPullRequestTimelineItemTO, GithubGitObjectTO, GithubNodeTO, GithubSubscribableTO, GithubUniformResourceLocatableTO {

private static final long serialVersionUID = 1L;

@javax.validation.constraints.NotNull
private String abbreviatedOid;
private int additions;
Expand Down Expand Up @@ -626,4 +628,4 @@ public class GithubCommitTO implements java.io.Serializable, GithubCloserTO, Git
}

}
}
}
2 changes: 2 additions & 0 deletions src/test/resources/expected-classes/Person.java.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ package com.kobylynskyi.graphql.test1;
)
public class Person implements java.io.Serializable, NamedEntity {

private static final long serialVersionUID = 1L;

private String name;
private Integer age;

Expand Down
4 changes: 3 additions & 1 deletion src/test/resources/expected-classes/Person1.java.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ package com.kobylynskyi.graphql.test1;
)
public class Person implements java.io.Serializable, NamedEntity {

private static final long serialVersionUID = 1L;

@Deprecated
private String name;
private Integer age;
Expand Down Expand Up @@ -84,4 +86,4 @@ public class Person implements java.io.Serializable, NamedEntity {
}

}
}
}
4 changes: 3 additions & 1 deletion src/test/resources/expected-classes/UnionMember1.java.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ package com.kobylynskyi.graphql.multifiles;
)
public class UnionMember1 implements java.io.Serializable, MyUnion {

private static final long serialVersionUID = 1L;

private Integer someField;

public UnionMember1() {
Expand Down Expand Up @@ -47,4 +49,4 @@ public class UnionMember1 implements java.io.Serializable, MyUnion {
}

}
}
}
4 changes: 3 additions & 1 deletion src/test/resources/expected-classes/UnionMember2.java.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ package com.kobylynskyi.graphql.multifiles;
)
public class UnionMember2 implements java.io.Serializable, MyUnion {

private static final long serialVersionUID = 1L;

private String someField;

public UnionMember2() {
Expand Down Expand Up @@ -47,4 +49,4 @@ public class UnionMember2 implements java.io.Serializable, MyUnion {
}

}
}
}
2 changes: 2 additions & 0 deletions src/test/resources/expected-classes/User.java.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ package com.kobylynskyi.graphql.test1;
)
public class User implements java.io.Serializable {

private static final long serialVersionUID = 1L;

private String name;
private java.util.List<User> friends;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ package com.kobylynskyi.graphql.test1;
@com.example.CustomAnnotation
public class EventProperty implements java.io.Serializable {

private static final long serialVersionUID = 1L;

private Double floatVal;
private Boolean booleanVal;
private int intVal;
Expand Down Expand Up @@ -189,4 +191,4 @@ public class EventProperty implements java.io.Serializable {
}

}
}
}
2 changes: 2 additions & 0 deletions src/test/resources/expected-classes/annotation/User.java.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ package com.kobylynskyi.graphql.test1;
)
public class User implements java.io.Serializable {

private static final long serialVersionUID = 1L;

private String name;
@com.example.Relationship(type = "FRIEND_WITH", direction = OUT)
private java.util.List<User> friends;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import java.util.StringJoiner;
)
public class ResponseContainingDate implements java.io.Serializable {

private static final long serialVersionUID = 1L;

private java.time.ZonedDateTime a;

public ResponseContainingDate() {
Expand Down Expand Up @@ -57,4 +59,4 @@ public class ResponseContainingDate implements java.io.Serializable {
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ package com.kobylynskyi.graphql.testdefaults;
)
public class InputWithDefaults implements java.io.Serializable {

private static final long serialVersionUID = 1L;

private Double floatVal = 1.23;
private Boolean booleanVal = false;
private Integer intVal = 42;
Expand Down Expand Up @@ -202,4 +204,4 @@ public class InputWithDefaults implements java.io.Serializable {
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ package com.kobylynskyi.graphql.testdefaults;
)
public class InputWithDefaultsDTO implements java.io.Serializable {

private static final long serialVersionUID = 1L;

private Double floatVal = 1.23;
private Boolean booleanVal = false;
private Integer intVal = 42;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ package com.kobylynskyi.graphql.testdefaults;
)
public class InputWithDefaultsTO implements java.io.Serializable {

private static final long serialVersionUID = 1L;

private Double floatVal = 1.23;
private Boolean booleanVal = false;
private Integer intVal = 42;
Expand Down Expand Up @@ -202,4 +204,4 @@ public class InputWithDefaultsTO implements java.io.Serializable {
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ package com.kobylynskyi.graphql.testdefaults;
)
public class SomeObject implements java.io.Serializable {

private static final long serialVersionUID = 1L;

@javax.validation.constraints.NotNull
private String name;

Expand Down Expand Up @@ -48,4 +50,4 @@ public class SomeObject implements java.io.Serializable {
}

}
}
}
Loading