-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The upper case JSON names #502
Comments
I don't have enough permissions for creating new branch |
Hi. The way to do this with GitHub is to fork this project, create a branch on your fork, add commits there then submit a pull request. If you Google for 'how to pull request' I think GitHub have a guide. Hope this helps. |
Duplicated and fixed by #563. |
This issue is still present:
Steps to reproduce: {
"type":"object",
"properties": {
"FOO_BAR": {
"type": "string"
},
"FOZ": {
"type": "integer"
},
"baz": {
"type": "boolean"
}
}
} http://www.jsonschema2pojo.org/ generates: -----------------------------------com.example.Baz.java-----------------------------------
package com.example;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class Baz {
@SerializedName("type")
@Expose
private String type;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
-----------------------------------com.example.Example.java-----------------------------------
package com.example;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class Example {
@SerializedName("type")
@Expose
private String type;
@SerializedName("properties")
@Expose
private Properties properties;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Properties getProperties() {
return properties;
}
public void setProperties(Properties properties) {
this.properties = properties;
}
}
-----------------------------------com.example.FOOBAR.java-----------------------------------
package com.example;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class FOOBAR {
@SerializedName("type")
@Expose
private String type;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
-----------------------------------com.example.FOZ.java-----------------------------------
package com.example;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class FOZ {
@SerializedName("type")
@Expose
private String type;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
-----------------------------------com.example.Properties.java-----------------------------------
package com.example;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class Properties {
@SerializedName("FOO_BAR")
@Expose
private FOOBAR fOOBAR;
@SerializedName("FOZ")
@Expose
private FOZ fOZ;
@SerializedName("baz")
@Expose
private Baz baz;
public FOOBAR getFOOBAR() {
return fOOBAR;
}
public void setFOOBAR(FOOBAR fOOBAR) {
this.fOOBAR = fOOBAR;
}
public FOZ getFOZ() {
return fOZ;
}
public void setFOZ(FOZ fOZ) {
this.fOZ = fOZ;
}
public Baz getBaz() {
return baz;
}
public void setBaz(Baz baz) {
this.baz = baz;
}
} |
@safar What version are you using? |
There is a bug with JSON filed name converting.
If JSON filed name consist of upper case characters then result Java field name also consist of upper uase characters.
I'll create a pull request which fixes this bug.
Thank you.
The text was updated successfully, but these errors were encountered: