44
44
import java .math .BigDecimal ;
45
45
import java .net .HttpURLConnection ;
46
46
import java .nio .charset .StandardCharsets ;
47
- import java .util .ArrayList ;
48
- import java .util .HashSet ;
49
- import java .util .List ;
50
- import java .util .Map ;
51
- import java .util .Random ;
52
- import java .util .Set ;
47
+ import java .util .*;
53
48
54
49
import static com .github .tomakehurst .wiremock .client .WireMock .*;
55
50
import static org .testng .Assert .*;
@@ -60,11 +55,35 @@ public class OpenAPIV3ParserTest {
60
55
protected WireMockServer wireMockServer ;
61
56
62
57
58
+ @ Test
59
+ public void testIssue853 () {
60
+ ParseOptions options = new ParseOptions ();
61
+ options .setResolve (true );
62
+ options .setFlatten (true );
63
+ final OpenAPI openAPI = new OpenAPIV3Parser ().readLocation ("issue-837-853/main.yaml" , null , options ).getOpenAPI ();
64
+
65
+ Assert .assertNotNull (openAPI );
66
+
67
+ Operation post = openAPI .getPaths ().get ("/guests" ).getPost ();
68
+ Assert .assertNotNull (post );
69
+
70
+ Content content = post .getResponses ().get ("201" ).getContent ();
71
+ Assert .assertNotNull (content );
72
+
73
+ Map <String , Example > examples = content .get ("application/json" ).getExamples ();
74
+ Assert .assertEquals (examples .size (), 1 );
75
+ assertNotNull (openAPI .getComponents ());
76
+ assertNotNull (openAPI .getComponents ().getExamples ());
77
+ assertNotNull (openAPI .getComponents ().getExamples ().get ("testExample" ));
78
+ assertEquals (((LinkedHashMap <String , Object >)openAPI .getComponents ().getExamples ().get ("testExample" ).getValue ()).get ("test" ),"value" );
79
+
80
+ }
81
+
63
82
@ Test
64
83
public void testIssue837 () {
65
84
ParseOptions options = new ParseOptions ();
66
85
options .setResolve (true );
67
- final OpenAPI openAPI = new OpenAPIV3Parser ().readLocation ("./issue837 /main.yaml" , null , options ).getOpenAPI ();
86
+ final OpenAPI openAPI = new OpenAPIV3Parser ().readLocation ("issue-837-853 /main.yaml" , null , options ).getOpenAPI ();
68
87
69
88
Assert .assertNotNull (openAPI );
70
89
0 commit comments