Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 3 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,9 @@ 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> {

@java.io.Serial
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,9 @@ package com.github.graphql;
)
public class CommentDeletedEvent implements java.io.Serializable, IssueTimelineItems, PullRequestTimelineItems, Node {

@java.io.Serial
private static final long serialVersionUID = 1L;

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

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

@java.io.Serial
private static final long serialVersionUID = 1L;

@javax.validation.constraints.NotNull
private String abbreviatedOid;
private int additions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ package com.github.graphql;
)
public class Commit implements java.io.Serializable, Closer, IssueTimelineItem, PullRequestTimelineItem, Subscribable, Node, GitObject, UniformResourceLocatable {

@java.io.Serial
private static final long serialVersionUID = 1L;

@javax.validation.constraints.NotNull
private String abbreviatedOid;
private int additions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ package com.github.graphql;
)
public class Commit implements java.io.Serializable, Closer, IssueTimelineItem, PullRequestTimelineItem, Subscribable, Node, GitObject, UniformResourceLocatable {

@java.io.Serial
private static final long serialVersionUID = 1L;

private String abbreviatedOid;
private int additions;
private PullRequestConnection associatedPullRequests;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ package com.github.graphql;
)
public class Commit implements java.io.Serializable, Closer, IssueTimelineItem, PullRequestTimelineItem, Subscribable, Node, GitObject, UniformResourceLocatable {

@java.io.Serial
private static final long serialVersionUID = 1L;

@javax.validation.constraints.NotNull
private String abbreviatedOid;
@javax.validation.constraints.NotNull
Expand Down
3 changes: 3 additions & 0 deletions src/test/resources/expected-classes/Event.java.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ package com.kobylynskyi.graphql.test1;
)
public class Event implements java.io.Serializable {

@java.io.Serial
private static final long serialVersionUID = 1L;

private String id;
private String categoryId;
private java.util.List<EventProperty> properties;
Expand Down
3 changes: 3 additions & 0 deletions src/test/resources/expected-classes/EventProperty.java.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ package com.kobylynskyi.graphql.test1;
)
public class EventProperty implements java.io.Serializable {

@java.io.Serial
private static final long serialVersionUID = 1L;

private Double floatVal;
private Boolean booleanVal;
private int intVal;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import java.util.StringJoiner;
)
public class EventPropertyTO implements java.io.Serializable {

@java.io.Serial
private static final long serialVersionUID = 1L;

private Double floatVal;
private Boolean booleanVal;
private int intVal;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import java.util.Objects;
)
public class EventPropertyTO implements java.io.Serializable {

@java.io.Serial
private static final long serialVersionUID = 1L;

private Double floatVal;
private Boolean booleanVal;
private int intVal;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ package com.kobylynskyi.graphql.test1;
*/
public class EventPropertyTO implements java.io.Serializable {

@java.io.Serial
private static final long serialVersionUID = 1L;

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

@java.io.Serial
private static final long serialVersionUID = 1L;

private String id;
private String categoryId;
private java.util.List<EventProperty> properties;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ package com.github.graphql;
)
public class GithubAcceptTopicSuggestionInputTO implements java.io.Serializable {

@java.io.Serial
private static final long serialVersionUID = 1L;

private String clientMutationId;
@javax.validation.constraints.NotNull
private String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ package com.github.graphql;
)
public class GithubAcceptTopicSuggestionPayloadTO implements java.io.Serializable {

@java.io.Serial
private static final long serialVersionUID = 1L;

private String clientMutationId;

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

@java.io.Serial
private static final long serialVersionUID = 1L;

@javax.validation.constraints.NotNull
private String abbreviatedOid;
private int additions;
Expand Down
3 changes: 3 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,9 @@ package com.kobylynskyi.graphql.test1;
)
public class Person implements java.io.Serializable, NamedEntity {

@java.io.Serial
private static final long serialVersionUID = 1L;

private String name;
private Integer age;

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

@java.io.Serial
private static final long serialVersionUID = 1L;

@Deprecated
private String name;
private Integer age;
Expand Down
3 changes: 3 additions & 0 deletions src/test/resources/expected-classes/UnionMember1.java.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ package com.kobylynskyi.graphql.multifiles;
)
public class UnionMember1 implements java.io.Serializable, MyUnion {

@java.io.Serial
private static final long serialVersionUID = 1L;

private Integer someField;

public UnionMember1() {
Expand Down
3 changes: 3 additions & 0 deletions src/test/resources/expected-classes/UnionMember2.java.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ package com.kobylynskyi.graphql.multifiles;
)
public class UnionMember2 implements java.io.Serializable, MyUnion {

@java.io.Serial
private static final long serialVersionUID = 1L;

private String someField;

public UnionMember2() {
Expand Down
3 changes: 3 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,9 @@ package com.kobylynskyi.graphql.test1;
)
public class User implements java.io.Serializable {

@java.io.Serial
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,9 @@ package com.kobylynskyi.graphql.test1;
@com.example.CustomAnnotation
public class EventProperty implements java.io.Serializable {

@java.io.Serial
private static final long serialVersionUID = 1L;

private Double floatVal;
private Boolean booleanVal;
private int intVal;
Expand Down
3 changes: 3 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,9 @@ package com.kobylynskyi.graphql.test1;
)
public class User implements java.io.Serializable {

@java.io.Serial
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,9 @@ import java.util.StringJoiner;
)
public class ResponseContainingDate implements java.io.Serializable {

@java.io.Serial
private static final long serialVersionUID = 1L;

private java.time.ZonedDateTime a;

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

@java.io.Serial
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,9 @@ package com.kobylynskyi.graphql.testdefaults;
)
public class InputWithDefaultsDTO implements java.io.Serializable {

@java.io.Serial
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,9 @@ package com.kobylynskyi.graphql.testdefaults;
)
public class InputWithDefaultsTO implements java.io.Serializable {

@java.io.Serial
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 @@ -7,6 +7,9 @@ package com.kobylynskyi.graphql.testdefaults;
)
public class SomeObject implements java.io.Serializable {

@java.io.Serial
private static final long serialVersionUID = 1L;

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

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

@java.io.Serial
private static final long serialVersionUID = 1L;

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

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

@java.io.Serial
private static final long serialVersionUID = 1L;

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

Expand Down
3 changes: 3 additions & 0 deletions src/test/resources/expected-classes/deprecated/Event.java.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ package com.kobylynskyi.graphql.test1;
)
public class Event implements java.io.Serializable, PinnableItem, Node {

@java.io.Serial
private static final long serialVersionUID = 1L;

@Deprecated
@javax.validation.constraints.NotNull
private Status status;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ package com.kobylynskyi.graphql.test1;
)
public class EventInput implements java.io.Serializable {

@java.io.Serial
private static final long serialVersionUID = 1L;

@Deprecated
@javax.validation.constraints.NotNull
private Status status;
Expand Down
3 changes: 3 additions & 0 deletions src/test/resources/expected-classes/empty/Event.java.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
)
public class Event implements java.io.Serializable {

@java.io.Serial
private static final long serialVersionUID = 1L;


public Event() {
}
Expand Down
3 changes: 3 additions & 0 deletions src/test/resources/expected-classes/empty/EventInput.java.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
)
public class EventInput implements java.io.Serializable {

@java.io.Serial
private static final long serialVersionUID = 1L;


public EventInput() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
)
public class Asset implements java.io.Serializable, PinnableItem, Node {

@java.io.Serial
private static final long serialVersionUID = 1L;

@javax.validation.constraints.NotNull
private String name;
@javax.validation.constraints.NotNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
)
public class AssetInput implements java.io.Serializable {

@java.io.Serial
private static final long serialVersionUID = 1L;

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
)
public class Event implements java.io.Serializable, PinnableItem, Node {

@java.io.Serial
private static final long serialVersionUID = 1L;

@javax.validation.constraints.NotNull
private Status status;
@javax.validation.constraints.NotNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
)
public class EventInput implements java.io.Serializable {

@java.io.Serial
private static final long serialVersionUID = 1L;

@javax.validation.constraints.NotNull
private Status status;
@javax.validation.constraints.NotNull
Expand Down
3 changes: 3 additions & 0 deletions src/test/resources/expected-classes/extend/Asset.java.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
)
public class Asset implements java.io.Serializable, PinnableItem, Node {

@java.io.Serial
private static final long serialVersionUID = 1L;

@javax.validation.constraints.NotNull
private String name;
@javax.validation.constraints.NotNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
)
public class AssetInput implements java.io.Serializable {

@java.io.Serial
private static final long serialVersionUID = 1L;

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

Expand Down
Loading