This repository was archived by the owner on Mar 16, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
src/test/kotlin/io/openapiprocessor/core/writer/java Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import io.openapiprocessor.core.converter.ApiOptions
1313import io.openapiprocessor.core.extractImports
1414import io.openapiprocessor.core.model.datatypes.DataTypeConstraints
1515import io.openapiprocessor.core.model.datatypes.ModelDataType
16+ import io.openapiprocessor.core.model.datatypes.PropertyDataType
1617import io.openapiprocessor.core.support.datatypes.ObjectDataType
1718import io.openapiprocessor.core.model.datatypes.StringDataType
1819import io.openapiprocessor.core.support.datatypes.ListDataType
@@ -122,4 +123,24 @@ class DataTypeWriterSpec: StringSpec({
122123 """ .trimMargin()
123124 }
124125
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+
125146})
You can’t perform that action at this time.
0 commit comments