This repository was archived by the owner on Mar 16, 2025. It is now read-only.
File tree 1 file changed +21
-0
lines changed
src/test/kotlin/io/openapiprocessor/core/writer/java
1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import io.openapiprocessor.core.converter.ApiOptions
13
13
import io.openapiprocessor.core.extractImports
14
14
import io.openapiprocessor.core.model.datatypes.DataTypeConstraints
15
15
import io.openapiprocessor.core.model.datatypes.ModelDataType
16
+ import io.openapiprocessor.core.model.datatypes.PropertyDataType
16
17
import io.openapiprocessor.core.support.datatypes.ObjectDataType
17
18
import io.openapiprocessor.core.model.datatypes.StringDataType
18
19
import io.openapiprocessor.core.support.datatypes.ListDataType
@@ -122,4 +123,24 @@ class DataTypeWriterSpec: StringSpec({
122
123
""" .trimMargin()
123
124
}
124
125
126
+ " writes properties with @JsonProperty access annotation" {
127
+ val dataType = ObjectDataType ("Foo ", "pkg", linkedMapOf(
128
+ "foo" to PropertyDataType (true, false, StringDataType ()),
129
+ "bar" to PropertyDataType (false, true, StringDataType ())
130
+ ))
131
+
132
+ // when:
133
+ writer.write (target, dataType)
134
+
135
+ // then:
136
+ target.toString ().contains ("""\
137
+ @JsonProperty (value = "foo", access = JsonProperty .Access .READ_ONLY )
138
+ private String foo;
139
+
140
+ @JsonProperty (value = "bar", access = JsonProperty .Access .WRITE_ONLY )
141
+ private String bar;
142
+
143
+ """)
144
+ }
145
+
125
146
})
You can’t perform that action at this time.
0 commit comments