File tree Expand file tree Collapse file tree 5 files changed +139
-106
lines changed
examples/java-generate-jackson-annotation/__snapshots__
src/generators/java/presets Expand file tree Collapse file tree 5 files changed +139
-106
lines changed Original file line number Diff line number Diff line change 33exports [` Should be able to generate data models for jackson annotation and should log expected output to console 1` ] = `
44Array [
55 "public class Root {
6- @JsonProperty (\\" min_number_prop\\ " )
76 @JsonInclude (JsonInclude .Include .NON_NULL )
87 private Double minNumberProp ;
9- @JsonProperty (\\" max_number_prop\\ " )
108 @JsonInclude (JsonInclude .Include .NON_NULL )
119 private Double maxNumberProp ;
1210 @JsonAnySetter
1311 @JsonInclude (JsonInclude .Include .NON_NULL )
1412 private Map < String , Object > additionalProperties ;
1513
14+ @JsonProperty (\\" min_number_prop\\ " )
1615 public Double getMinNumberProp () { return this.minNumberProp; }
1716 public void setMinNumberProp (Double minNumberProp ) { this.minNumberProp = minNumberProp; }
1817
18+ @JsonProperty (\\" max_number_prop\\ " )
1919 public Double getMaxNumberProp () { return this.maxNumberProp; }
2020 public void setMaxNumberProp (Double maxNumberProp ) { this.maxNumberProp = maxNumberProp; }
2121
Original file line number Diff line number Diff line change @@ -51,13 +51,6 @@ export const JAVA_JACKSON_PRESET: JavaPreset = {
5151 return renderer . renderBlock ( blocks ) ;
5252 }
5353
54- blocks . push (
55- renderer . renderAnnotation (
56- 'JsonProperty' ,
57- `"${ property . unconstrainedPropertyName } "`
58- )
59- ) ;
60-
6154 if ( ! property . required ) {
6255 blocks . push (
6356 renderer . renderAnnotation (
@@ -85,6 +78,13 @@ export const JAVA_JACKSON_PRESET: JavaPreset = {
8578 const blocks : string [ ] = [ ] ;
8679 if ( hasUnwrappedOptions ) {
8780 blocks . push ( renderer . renderAnnotation ( 'JsonAnyGetter' ) ) ;
81+ } else {
82+ blocks . push (
83+ renderer . renderAnnotation (
84+ 'JsonProperty' ,
85+ `"${ property . unconstrainedPropertyName } "`
86+ )
87+ ) ;
8888 }
8989 blocks . push ( content ) ;
9090 return renderer . renderBlock ( blocks ) ;
You can’t perform that action at this time.
0 commit comments