File tree Expand file tree Collapse file tree 1 file changed +14
-7
lines changed
openapi-annotation-processor/src/test/kotlin/io/javalin/openapi/processor Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -75,24 +75,31 @@ internal class ComponentAnnotationsTest : OpenApiAnnotationProcessorSpecificatio
75
75
""" ))
76
76
}
77
77
78
- private class ClassWithNullableProperty (
78
+ private class ClassWithNullableProperties (
79
79
@get:OpenApiNullable
80
- val testProperty : String
80
+ val testProperty : String ,
81
+ @get:OpenApiNullable(nullable = false)
82
+ val optionalProperty : String? ,
81
83
)
82
84
83
85
@OpenApi(
84
- path = " /nullable " ,
85
- versions = [" should_add_nullable_property " ],
86
- responses = [OpenApiResponse (status = " 200" , content = [OpenApiContent (from = ClassWithNullableProperty ::class )])]
86
+ path = " /nullability " ,
87
+ versions = [" should_control_nullability " ],
88
+ responses = [OpenApiResponse (status = " 200" , content = [OpenApiContent (from = ClassWithNullableProperties ::class )])]
87
89
)
88
90
@Test
89
- fun should_add_nullable_property () = withOpenApi(" should_add_nullable_property " ) {
91
+ fun should_add_nullable_property () = withOpenApi(" should_control_nullability " ) {
90
92
println (it)
91
93
92
94
assertThatJson(it)
93
- .inPath(" $.components.schemas.ClassWithNullableProperty .properties.testProperty" )
95
+ .inPath(" $.components.schemas.ClassWithNullableProperties .properties.testProperty" )
94
96
.isObject
95
97
.containsEntry(" nullable" , true )
98
+
99
+ assertThatJson(it)
100
+ .inPath(" $.components.schemas.ClassWithNullableProperties.properties.optionalProperty" )
101
+ .isObject
102
+ .containsEntry(" nullable" , false )
96
103
}
97
104
98
105
}
You can’t perform that action at this time.
0 commit comments