Skip to content
This repository was archived by the owner on Mar 16, 2025. It is now read-only.

Commit 5eb9273

Browse files
committed
1 parent d182425 commit 5eb9273

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/test/kotlin/io/openapiprocessor/core/writer/java/DataTypeWriterSpec.kt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import io.openapiprocessor.core.converter.ApiOptions
1313
import io.openapiprocessor.core.extractImports
1414
import io.openapiprocessor.core.model.datatypes.DataTypeConstraints
1515
import io.openapiprocessor.core.model.datatypes.ModelDataType
16+
import io.openapiprocessor.core.model.datatypes.PropertyDataType
1617
import io.openapiprocessor.core.support.datatypes.ObjectDataType
1718
import io.openapiprocessor.core.model.datatypes.StringDataType
1819
import 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
})

0 commit comments

Comments
 (0)