File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
modules/swagger-core/src/test/java/io/swagger/v3/core/resolving Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,34 @@ public void testEnumGenerics() {
56
56
assertNotNull (model .getProperties ().get ("type" ));
57
57
}
58
58
59
+ @ Test
60
+ public void testEnumPropertyWithSchemaAnnotation () {
61
+ final ModelResolver modelResolver = new ModelResolver (mapper ()).openapi31 (true );
62
+ final ModelConverterContextImpl context = new ModelConverterContextImpl (modelResolver );
63
+
64
+ final Schema model = context .resolve (new AnnotatedType ().type (ClassWithEnumAsRefProperty .class ));
65
+ assertNotNull (model );
66
+ assertEquals (model .getName (), "ClassWithEnumAsRefProperty" );
67
+ assertTrue (model .getProperties ().containsKey ("enumWithSchemaProperty" ));
68
+ final Schema enumPropertySchema = (Schema ) model .getProperties ().get ("enumWithSchemaProperty" );
69
+ assertNotNull (enumPropertySchema .get$ref ());
70
+ }
71
+
72
+ public static class ClassWithEnumAsRefProperty {
73
+
74
+ @ io .swagger .v3 .oas .annotations .media .Schema (enumAsRef = true )
75
+ public final EnumWithSchemaProperty enumWithSchemaProperty ;
76
+
77
+ public ClassWithEnumAsRefProperty (EnumWithSchemaProperty enumWithSchemaProperty ) {
78
+ this .enumWithSchemaProperty = enumWithSchemaProperty ;
79
+ }
80
+
81
+ public enum EnumWithSchemaProperty {
82
+ VALUE1 ,
83
+ VALUE2
84
+ }
85
+ }
86
+
59
87
public enum Currency {
60
88
USA , CANADA
61
89
}
You can’t perform that action at this time.
0 commit comments