11package io .swagger .v3 .parser .test ;
22
3- import io .swagger .v3 .core .util .Json ;
43import io .swagger .v3 .oas .models .OpenAPI ;
54import io .swagger .v3 .oas .models .examples .Example ;
65import io .swagger .v3 .oas .models .media .Schema ;
76import io .swagger .v3 .parser .OpenAPIV3Parser ;
87import io .swagger .v3 .parser .core .models .ParseOptions ;
9- import io .swagger .v3 .parser .core .models .SwaggerParseResult ;
108import org .testng .annotations .Test ;
119
1210import static org .testng .Assert .*;
@@ -54,7 +52,7 @@ public void testSchemaDefaultNotSet() {
5452
5553 OpenAPI openAPI = new OpenAPIV3Parser ().readContents (yaml , null , null ).getOpenAPI ();
5654 assertNotNull (openAPI );
57-
55+
5856 Schema schema = openAPI .getComponents ().getSchemas ().get ("NoDefaultSchema" );
5957 assertNotNull (schema );
6058 assertNull (schema .getDefault (), "Default should be null" );
@@ -76,7 +74,7 @@ public void testSchemaExampleExplicitlyNull() {
7674
7775 OpenAPI openAPI = new OpenAPIV3Parser ().readContents (yaml , null , null ).getOpenAPI ();
7876 assertNotNull (openAPI );
79-
77+
8078
8179 Schema schema = openAPI .getComponents ().getSchemas ().get ("NullExampleSchema" );
8280 assertNotNull (schema );
@@ -98,7 +96,7 @@ public void testSchemaExampleNotSet() {
9896
9997 OpenAPI openAPI = new OpenAPIV3Parser ().readContents (yaml , null , null ).getOpenAPI ();
10098 assertNotNull (openAPI );
101-
99+
102100
103101 Schema schema = openAPI .getComponents ().getSchemas ().get ("NoExampleSchema" );
104102 assertNotNull (schema );
@@ -120,7 +118,7 @@ public void testExampleValueExplicitlyNull() {
120118
121119 OpenAPI openAPI = new OpenAPIV3Parser ().readContents (yaml , null , null ).getOpenAPI ();
122120 assertNotNull (openAPI );
123-
121+
124122
125123 Example example = openAPI .getComponents ().getExamples ().get ("NullExample" );
126124 assertNotNull (example );
@@ -142,7 +140,7 @@ public void testExampleValueNotSet() {
142140
143141 OpenAPI openAPI = new OpenAPIV3Parser ().readContents (yaml , null , null ).getOpenAPI ();
144142 assertNotNull (openAPI );
145-
143+
146144
147145 Example example = openAPI .getComponents ().getExamples ().get ("NoValueExample" );
148146 assertNotNull (example );
@@ -204,7 +202,7 @@ public void testAnyOfNullExampleNotPropagated() {
204202 ParseOptions options = new ParseOptions ();
205203 options .setResolveFully (true );
206204 options .setResolveCombinators (true );
207-
205+
208206 OpenAPI openAPI = new OpenAPIV3Parser ().readContents (yaml , null , options ).getOpenAPI ();
209207 assertNotNull (openAPI );
210208
@@ -236,10 +234,10 @@ public void testOneOfExplicitNullExamplePreserved() {
236234 ParseOptions options = new ParseOptions ();
237235 options .setResolveFully (true );
238236 options .setResolveCombinators (true );
239-
237+
240238 OpenAPI openAPI = new OpenAPIV3Parser ().readContents (yaml , null , options ).getOpenAPI ();
241239 assertNotNull (openAPI );
242-
240+
243241 Schema combined = openAPI .getComponents ().getSchemas ().get ("CombinedSchema" );
244242 assertNotNull (combined );
245243 assertNull (combined .getExample (), "Example should be null" );
@@ -314,11 +312,11 @@ public void testParameterSchemaExampleNullVsNotSet() {
314312
315313 java .util .List <io .swagger .v3 .oas .models .parameters .Parameter > params = openAPI .getPaths ().get ("/test" ).getGet ().getParameters ();
316314 assertEquals (params .size (), 2 );
317-
315+
318316 Schema nullSchema = params .get (0 ).getSchema ();
319317 assertNull (nullSchema .getExample ());
320318 assertTrue (nullSchema .getExampleSetFlag (), "Should be explicitly set to null" );
321-
319+
322320 Schema noExampleSchema = params .get (1 ).getSchema ();
323321 assertNull (noExampleSchema .getExample ());
324322 assertFalse (noExampleSchema .getExampleSetFlag (), "Should not be set" );
@@ -348,13 +346,13 @@ public void testMediaTypeExampleNullVsNotSet() {
348346
349347 OpenAPI openAPI = new OpenAPIV3Parser ().readContents (yaml , null , null ).getOpenAPI ();
350348 assertNotNull (openAPI );
351-
349+
352350 io .swagger .v3 .oas .models .media .Content content = openAPI .getPaths ().get ("/test" ).getPost ().getRequestBody ().getContent ();
353-
351+
354352 io .swagger .v3 .oas .models .media .MediaType jsonMedia = content .get ("application/json" );
355353 assertNull (jsonMedia .getExample ());
356354 assertTrue (jsonMedia .getExampleSetFlag (), "Should be explicitly set to null" );
357-
355+
358356 io .swagger .v3 .oas .models .media .MediaType xmlMedia = content .get ("application/xml" );
359357 assertNull (xmlMedia .getExample ());
360358 assertFalse (xmlMedia .getExampleSetFlag (), "Should not be set" );
@@ -383,13 +381,13 @@ public void testHeaderSchemaExampleNullVsNotSet() {
383381
384382 OpenAPI openAPI = new OpenAPIV3Parser ().readContents (yaml , null , null ).getOpenAPI ();
385383 assertNotNull (openAPI );
386-
384+
387385 java .util .Map <String , io .swagger .v3 .oas .models .headers .Header > headers = openAPI .getPaths ().get ("/test" ).getGet ().getResponses ().get ("200" ).getHeaders ();
388-
386+
389387 Schema nullSchema = headers .get ("X-Null-Example" ).getSchema ();
390388 assertNull (nullSchema .getExample ());
391389 assertTrue (nullSchema .getExampleSetFlag (), "Should be explicitly set to null" );
392-
390+
393391 Schema noExampleSchema = headers .get ("X-No-Example" ).getSchema ();
394392 assertNull (noExampleSchema .getExample ());
395393 assertFalse (noExampleSchema .getExampleSetFlag (), "Should not be set" );
@@ -426,7 +424,7 @@ public void testAllOfMultipleDifferentDefaults() {
426424 ParseOptions options = new ParseOptions ();
427425 options .setResolveFully (true );
428426 options .setResolveCombinators (true );
429-
427+
430428 OpenAPI openAPI = new OpenAPIV3Parser ().readContents (yaml , null , options ).getOpenAPI ();
431429 assertNotNull (openAPI );
432430
@@ -461,10 +459,10 @@ public void testResolveFullyWithoutCombinators() {
461459 ParseOptions options = new ParseOptions ();
462460 options .setResolveFully (true );
463461 options .setResolveCombinators (false );
464-
462+
465463 OpenAPI openAPI = new OpenAPIV3Parser ().readContents (yaml , null , options ).getOpenAPI ();
466464 assertNotNull (openAPI );
467-
465+
468466
469467 Schema extended = openAPI .getComponents ().getSchemas ().get ("ExtendedSchema" );
470468 assertNotNull (extended );
0 commit comments