@@ -87,6 +87,7 @@ public class V2ConverterTest {
87
87
private static final String ISSUE_762_JSON = "issue-762.json" ;
88
88
private static final String ISSUE_765_YAML = "issue-765.yaml" ;
89
89
private static final String ISSUE_768_JSON = "issue-786.json" ;
90
+ private static final String ISSUE_820_YAML = "issue-820.yaml" ;
90
91
91
92
private static final String API_BATCH_PATH = "/api/batch/" ;
92
93
private static final String PETS_PATH = "/pets" ;
@@ -725,6 +726,33 @@ public void testIssue755() throws Exception {
725
726
final OpenAPI oas = getConvertedOpenAPIFromJsonFile (ISSUE_755_YAML );
726
727
assertNotNull (oas );
727
728
}
729
+
730
+ @ Test (description = "OpenAPI v2 converter - Conversion param extensions should be preserved" )
731
+ public void testIssue820 () throws Exception {
732
+ final OpenAPI oas = getConvertedOpenAPIFromJsonFile (ISSUE_820_YAML );
733
+ assertNotNull (oas );
734
+ Operation post = oas .getPaths ().get ("/issue820" ).getPost ();
735
+ assertNotNull (post .getRequestBody ().getContent ().get ("multipart/form-data" ));
736
+ assertNotNull (post .getRequestBody ().getContent ().get ("multipart/form-data" ).getSchema ());
737
+ Map <String , Schema > properties = post .getRequestBody ().getContent ().get ("multipart/form-data" ).getSchema ().getProperties ();
738
+ assertNotNull (properties );
739
+ assertEquals (properties .size (), 3 , "size" );
740
+ Schema foo = properties .get ("foo" );
741
+ assertNotNull (foo );
742
+ assertNotNull (foo .getExtensions ());
743
+ assertEquals (foo .getExtensions ().get ("x-ext" ), "some foo" );
744
+ assertEquals (foo .getNullable (), null );
745
+ Schema bar = properties .get ("bar" );
746
+ assertNotNull (bar );
747
+ assertNotNull (bar .getExtensions ());
748
+ assertEquals (bar .getExtensions ().get ("x-ext" ), "some bar" );
749
+ assertEquals (bar .getNullable (), Boolean .TRUE );
750
+ Schema baz = properties .get ("baz" );
751
+ assertNotNull (baz );
752
+ assertNotNull (baz .getExtensions ());
753
+ assertEquals (baz .getExtensions ().get ("x-ext" ), "some baz" );
754
+ assertEquals (baz .getNullable (), Boolean .FALSE );
755
+ }
728
756
729
757
private OpenAPI getConvertedOpenAPIFromJsonFile (String file ) throws IOException , URISyntaxException {
730
758
SwaggerConverter converter = new SwaggerConverter ();
0 commit comments