-
Notifications
You must be signed in to change notification settings - Fork 181
Issue with the generated POJO's #76
Comments
There are two issues. First, you are allowing extra properties to be added to your object because you miss the following property:
Add it to your 3 object schemas (ie. Second, you use a To fix this issue you can either switch to the @petrochenko-pavel-a Please upgrade JsonSchema2Pojo to 0.4.11 😉 |
Thanks for the feedback on additionalProperties. How do I upgrade JsonSchema2Pojo ? I am just using the maven plugin to generate the Pojos in maven project. Could you please share the details. |
Done, snapshot builds are now using 0.4.11 |
I am using version 1.3.3 because I think we had issues on the one checked in the repository which I believe is the snapshot version. Could you tell me where can I get the most stable build and what's the version? |
@rajkumar1979 Version |
Sorry , Its a little confusing. I am using the version 1.3.3 to generated the raml to jaxrs classes, I thought you fixed 1.3.3 by upgrading to the latest JsonSchematoPojo, I thought you mentioned that you fixed it in the snapshot release,Could you please tell me the snapshot version of the plugin that I can use to generate these artifacts. |
Generally you need to use 1.3.4-SNAPSHOT. The snapshots are published at Regards, On Mon, Apr 27, 2015 at 6:35 AM, rajkumar1979 [email protected]
|
After updating the 1.3.4-SNAPSHOT, when I print the response it displays the following json I am not sure why its including an element named additionalProperties as part of every object in the response. |
I also tried to print the request that is being sent and tried to echo the same as response. input to my service Output { It adds additionalProperties as part of every object. this was not hapenning in 1.3.3 |
What JSON provider do you use with JAX-RS? Jackson? |
I am using jackson. Also My json schema does not have addiitonal properties, I tried without that and it still puts those aspart of every object |
Very strange, never seen this before. Can you show your latest plugin config and latest JSON schema? |
I added the plugin I added the plugin repository as well sonatype-public-repository https://oss.sonatype.org/content/groups/public true trueMy raml definition
|
Schema Definition that I used{
|
Hi, I have no bandwidth right now, but promise to dedicate time in nearest days probably Friday or Satarday to dig deep into this. |
@rajkumar1979 Your comments are unreadable. Can you please format them? Also, I don't see |
I dont have additionalProperties in my schema, thats why I am surprised as why it gets included in the response. How can I attach a file to this? |
If you do not have additionalProperties set to false in your schema, you will get the additionalProperties catch-all field. You can not attach files: edit your previous comments and format them with Markdown (see https://help.github.com/articles/github-flavored-markdown/ for syntax). |
Hi , The Key was additionalProperties, I set it to false and it works now. Thanks for all the help and assistance. Thanks Raj. |
Hi , I do face the same issue .
|
are you following any standard for generating the POJO's from json schema,
My Json schema has a complex object of type
"paymentDetails":{
When I test the generated POJO's by passing a sample request, it allows an object that does not adhere to this schema.
In the past when we generated objects using JAXB, when we pass an object that does not adhere to an xml schema , jersey considers that as a invalid request, but in this case the request is allowed to pass through.
Example the malformed request that was used is, I had changed the request to use an element called attr which is not there in the schema , but jersey does not validate that.
{
"accountDetails": {
"accountID": "123145631722297",
"accountClassification": "SmallBusiness",
"accountSubClassification": "Regular",
"personaID": "123145631723942",
"authID": "123145631723942"
},
"offerID": "20000000",
"paymentDetails": {
"type": "CreditCard",
"attr": [
{
"name": "nameOnCard",
"value": "John"
},
{
"name": "cardNumber",
"value": "9919930747642032"
},
{
"name": "expirationMonth",
"value": "11"
},
{
"name": "expirationYear",
"value": "2015"
},
{
"name": "cvn",
"value": "123"
}
],
"paymentAddress": {
"addressLine1": "123 main str",
"addressLine2": "APT 122",
"addressLine3": "Near Macdonald",
"addressLine4": "OPP Gas station",
"city": "San Diego",
"stateOrProvince": "CA",
"postalCode": "92122",
"country": "US"
}
}
}
The text was updated successfully, but these errors were encountered: