Closed WhileTrueEndWhile closed 6 years ago
Hi,
JJSchema ignores the @JsonProperty annotation, which causes Jackson to create a JSON object which differs from the JSON schema definition.
@JsonProperty
Let's take a look at the following example class...
public class MyClass { @JsonProperty("my_attribute") private String myAttribute; public String getMyAttributes() { return myAttribute; } public MyClass setMyAttribute(String myAttribute) { this.myAttribute = myAttribute; return this; } }
The code ...
new ObjectMapper().writeValueAsString(new MyClass().setMyAttribute("Hello World"));
... produces ...
{ "my_attribute": "Hello World" }
... but JJSchema produces ...
{ "properties": { "myAttribute": { "type": "string" } } }
Any ideas?
I found a dirty solution which is documented in the current test:
https://github.com/WhileTrueEndWhile/JJSchema/blob/master/src/test/java/com/github/reinert/jjschema/xproperties/XPropertiesTest.java
Using an X Property like properties = com.github.reinert.jjschema.xproperties.XPropertiesTest$RenameFactory:example -> another_name renames example to another_name...
properties = com.github.reinert.jjschema.xproperties.XPropertiesTest$RenameFactory:example -> another_name
example
another_name
Hi,
JJSchema ignores the
@JsonProperty
annotation, which causes Jackson to create a JSON object which differs from the JSON schema definition.Let's take a look at the following example class...
The code ...
... produces ...
... but JJSchema produces ...
Any ideas?
I found a dirty solution which is documented in the current test:
https://github.com/WhileTrueEndWhile/JJSchema/blob/master/src/test/java/com/github/reinert/jjschema/xproperties/XPropertiesTest.java
Using an X Property like
properties = com.github.reinert.jjschema.xproperties.XPropertiesTest$RenameFactory:example -> another_name
renamesexample
toanother_name
...