bug:
Classes and constants in generated class DgsConstants.java do not follows common Java naming conventions, neither Kotlin naming convetions.
Also generated classes for clients has underscores in its names, which is not common for Java/Kotlin classes.
Expected behavior
Expected generated output:
public static class Employee {
public static final String TYPE_NAME = "Employee";
public static final String USERNAME = "username";
public static final String FIRST_NAME = "firstName";
public static final String LAST_NAME = "lastName";
public static final String AGE = "age";
}
Actual behavior
Example of generated class:
public static class EMPLOYEE {
public static final String TYPE_NAME = "Employee";
public static final String Username = "username";
public static final String FirstName = "firstName";
public static final String LastName = "lastName";
public static final String Age = "age";
}
Steps to reproduce
Generate DgsConstants.java class from any schema.graphqls.
Note: Maybe there is idea behind not-convention naming style; if so, i would really appreciate any explanation, thank you.
I suppose we went with capitalizing the parent types and the field names are all lower case for readability. No other strong arguments one way or another. However, since it has been this way, it would be a breaking change to update this behavior. Is this causing particular problems for you, besides the fact that it is not what you expect?
Thank you for your answer. We have problem with readability, to be honest. Java code in all projects meets given name conventions, developers are use to it, and we don't want to have at once on one place in code something different - it can be misleading at first sight. I believe that we are not the first team which can be little bit confused by seeing DgsConstants.EMPLOYEE.Username instead of DgsConstants.Employee.USERNAME in the code. One can think, that Username is not a constant.
Of course, it is a matter of style. I absolutely understand, that it would be a breaking change. But what about add possibility to customize constant generating to meet official java name convention? Does that make sense to you?
Closing this as it's not something we're planning to change.