File tree Expand file tree Collapse file tree 3 files changed +37
-0
lines changed
modules/swagger-parser-v2-converter/src
main/java/io/swagger/v3/parser/converter
java/io/swagger/parser/test Expand file tree Collapse file tree 3 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -831,6 +831,7 @@ private RequestBody convertParameterToRequestBody(io.swagger.models.parameters.P
831
831
}
832
832
}
833
833
convertExamples (((BodyParameter ) param ).getExamples (), content );
834
+ body .setExtensions (convert (param .getVendorExtensions ()));
834
835
body .content (content );
835
836
return body ;
836
837
}
Original file line number Diff line number Diff line change @@ -97,6 +97,8 @@ public class V2ConverterTest {
97
97
private static final String ISSUE_1164_YAML = "issue-1164.yaml" ;
98
98
private static final String ISSUE_1261_YAML = "issue-1261.yaml" ;
99
99
100
+ private static final String ISSUE_1715_YAML = "issue-1715.yaml" ;
101
+
100
102
private static final String API_BATCH_PATH = "/api/batch/" ;
101
103
private static final String PETS_PATH = "/pets" ;
102
104
private static final String PET_FIND_BY_STATUS_PATH = "/pet/findByStatus" ;
@@ -852,6 +854,16 @@ public void testissue1261() throws Exception {
852
854
853
855
}
854
856
857
+ @ Test (description = "OpenAPI v2 converter - vendor extensions on body parameters copied to output RequestBody" )
858
+ public void testissue1715 () throws Exception {
859
+ OpenAPI oas = getConvertedOpenAPIFromJsonFile (ISSUE_1715_YAML );
860
+ assertNotNull (oas );
861
+ RequestBody requestBody = oas .getPaths ().get ("/foo" ).getPost ().getRequestBody ();
862
+ assertNotNull (requestBody .getExtensions ());
863
+ assertEquals (1 , requestBody .getExtensions ().size ());
864
+ assertEquals ("bar" , requestBody .getExtensions ().get ("x-foo" ));
865
+ }
866
+
855
867
@ Test ()
856
868
public void testInlineDefinitionProperty () throws Exception {
857
869
SwaggerConverter converter = new SwaggerConverter ();
Original file line number Diff line number Diff line change
1
+ swagger : ' 2.0'
2
+ info :
3
+ title : Test for Issue 1715
4
+ version : 1.0.0
5
+ paths :
6
+ /foo :
7
+ post :
8
+ operationId : doFoo
9
+ parameters :
10
+ - in : body
11
+ name : body
12
+ schema :
13
+ $ref : ' #/definitions/SomeObj'
14
+ required : true
15
+ x-foo : bar
16
+ responses :
17
+ ' 200 ' :
18
+ description : OK
19
+ definitions :
20
+ SomeObj :
21
+ type : string
22
+ minLength : 1
23
+ maxLength : 3
24
+ pattern : ^[0-9]+$
You can’t perform that action at this time.
0 commit comments