Skip to content
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

Reserved Java words are not transformed during object generation when propertyWordDelimiters=_ is used #72

Closed
joelittlejohn opened this issue Jun 23, 2013 · 4 comments
Milestone

Comments

@joelittlejohn
Copy link
Owner

Original author: jgert...@gmail.com (August 27, 2012 20:32:35)

What steps will reproduce the problem?

  1. Create a JSON schema for an object name such as "Paper" and a property such as "abstract"
  2. Generate the source DTO's using jsonschema2pojo

What is the expected output?
-The generated field name for "abstract" in the DTO "Paper" is named "abstractValue".

What do you see instead?
-A generated "Paper" DTO class with a compile error caused by using the reserved word "abstract".

What version of the product are you using? On what Java version? (On what
version of Maven/Ant if applicable?) v0.3.2 on Java 1.6.

Original issue: http://code.google.com/p/jsonschema2pojo/issues/detail?id=72

@joelittlejohn
Copy link
Owner Author

From joelittl...@gmail.com on August 27, 2012 20:51:06
Thanks for taking the time to report this Josh. Could you possibly provide an example schema? I'm having trouble replicating your compile error.

This problem has been reported previously as issue # 63 . This was fixed in 0.3.2 so I'm confused that you're still seeing this problem in that version. There's an integration test that covers using Java keywords in property names:

http://code.google.com/p/jsonschema2pojo/source/browse/jsonschema2pojo-integration-tests/src/test/java/com/googlecode/jsonschema2pojo/integration/PropertiesIT.java?name=jsonschema2pojo-0.3.2#126

I didn't include the 'abstract' keyword in the test, but I've just checked this manually and it appears to work fine.

Is it possible that you're not using 0.3.2?

@joelittlejohn
Copy link
Owner Author

From jgert...@gmail.com on August 27, 2012 21:47:12
Thanks for the quick response Joe. Here's the schema:

{
"description":"A research paper",
"type":"object",
"properties":{
"abstract":{"type":"string"}
}
}

Maven spits this back at me before listing the classes, so I think it's using 0.3.2:
[INFO] --- jsonschema2pojo-maven-plugin:0.3.2:generate (default)

Here's my Maven config:

com.googlecode.jsonschema2pojo jsonschema2pojo-maven-plugin 0.3.2 ${basedir}/src/main/resources/schema com.mycompany.model _- generate

@joelittlejohn
Copy link
Owner Author

From joelittl...@gmail.com on August 27, 2012 22:03:10
Ah, I see now that the problem seems to be specifically associated with using propertyWordDelimiters.

@joelittlejohn
Copy link
Owner Author

From joelittl...@gmail.com on August 28, 2012 22:35:35
Fixed (r04e36177fec8).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant