File tree Expand file tree Collapse file tree 3 files changed +31
-2
lines changed
main/java/com/fasterxml/jackson/module/jsonSchema/factories
test/java/com/fasterxml/jackson/module/jsonSchema/failing Expand file tree Collapse file tree 3 files changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -116,5 +116,4 @@ protected JsonSerializer<Object> getSer(BeanProperty prop)
116
116
}
117
117
return ser ;
118
118
}
119
-
120
119
}
Original file line number Diff line number Diff line change
1
+ package com .fasterxml .jackson .module .jsonSchema .failing ;
2
+
3
+ import com .fasterxml .jackson .databind .ObjectMapper ;
4
+ import com .fasterxml .jackson .module .jsonSchema .JsonSchema ;
5
+ import com .fasterxml .jackson .module .jsonSchema .JsonSchemaGenerator ;
6
+ import com .fasterxml .jackson .module .jsonSchema .SchemaTestBase ;
7
+
8
+ public class TestCyclic extends SchemaTestBase
9
+ {
10
+ // [Issue#4]
11
+ public class Loop {
12
+ public String name ;
13
+ public Loop next ;
14
+ }
15
+
16
+ private final ObjectMapper MAPPER = objectMapper ();
17
+
18
+ // [Issue#4]
19
+ public void testSimpleCyclic () throws Exception
20
+ {
21
+ JsonSchemaGenerator generator = new JsonSchemaGenerator (MAPPER );
22
+ JsonSchema schema = generator .generateSchema (Loop .class );
23
+
24
+ String json = MAPPER .writeValueAsString (schema ).replace ('"' , '\'' );
25
+ String EXP = "{'type':'object','properties':{"
26
+ +"'name':{'type':'string'}},'next':{'type':'object'}}}" ;
27
+ // System.err.println("JSON: "+json);
28
+ assertEquals (EXP , json );
29
+ }
30
+ }
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ static class Name {
27
27
/**********************************************************
28
28
*/
29
29
30
- private final ObjectMapper MAPPER = new ObjectMapper ();
30
+ private final ObjectMapper MAPPER = objectMapper ();
31
31
32
32
public void testUnwrapping () throws Exception
33
33
{
You can’t perform that action at this time.
0 commit comments