Updated cyclifRef test case to reproduce a stack overflow issue, as an example
authorJames Meen <james.meen@my-managed.net>
Tue, 5 Feb 2019 01:12:41 +0000 (01:12 +0000)
committerJames Meen <james.meen@my-managed.net>
Tue, 5 Feb 2019 01:12:41 +0000 (01:12 +0000)
geronimo-openapi-impl/src/test/java/org/apache/geronimo/microprofile/openapi/impl/processor/SchemaProcessorTest.java

index aa88932..b2a0a1f 100644 (file)
@@ -61,7 +61,7 @@ public class SchemaProcessorTest {
         assertSomeClass(schema.getProperties().get("child"));
         final Schema children = schema.getProperties().get("children");
         assertEquals(Schema.SchemaType.ARRAY, children.getType());
-        assertSomeClass(children.getItems());
+        assertSomeRelatedClass(children.getItems());
     }
 
     private void assertSomeClass(final Schema schema) {
@@ -69,14 +69,24 @@ public class SchemaProcessorTest {
         assertEquals(Stream.of("simple", "child", "children").collect(toSet()), schema.getProperties().keySet());
     }
 
+    private void assertSomeRelatedClass(final Schema schema) {
+        assertEquals(Schema.SchemaType.OBJECT, schema.getType());
+        assertEquals(Stream.of("simple", "children").collect(toSet()), schema.getProperties().keySet());
+    }
+
     public enum AnEnum {
         A, B
     }
 
     public static class SomeClass {
         private String simple;
+        private List<SomeRelatedClass> children;
         private SomeClass child;
-        private List<SomeClass> children;
+    }
+
+    public static class SomeRelatedClass {
+        private String simple;
+        private List<SomeRelatedClass> children;
     }
 
     public static class DataWithEnum {