@@ -637,7 +637,7 @@ public void resolveInlineRequestBody() throws Exception {
637
637
RequestBody body = getOperation .getRequestBody ();
638
638
assertTrue (body .getContent ().get ("*/*" ).getSchema ().get$ref () != null );
639
639
640
- Schema bodySchema = openAPI .getComponents ().getSchemas ().get ("helloBody " );
640
+ Schema bodySchema = openAPI .getComponents ().getSchemas ().get ("hello_body " );
641
641
assertTrue (bodySchema instanceof Schema );
642
642
643
643
assertNotNull (bodySchema .getProperties ().get ("address" ));
@@ -676,7 +676,48 @@ public void resolveInlineRequestBody_maxTwoPathParts() throws Exception {
676
676
RequestBody body = getOperation .getRequestBody ();
677
677
assertTrue (body .getContent ().get ("*/*" ).getSchema ().get$ref () != null );
678
678
679
- Schema bodySchema = openAPI .getComponents ().getSchemas ().get ("greethelloBody" );
679
+ Schema bodySchema = openAPI .getComponents ().getSchemas ().get ("greet_hello_body" );
680
+ assertTrue (bodySchema instanceof Schema );
681
+
682
+ assertNotNull (bodySchema .getProperties ().get ("address" ));
683
+ }
684
+
685
+ @ Test
686
+ public void resolveInlineRequestBody_stripsDotsFromPath () throws Exception {
687
+ OpenAPI openAPI = new OpenAPI ();
688
+
689
+ ObjectSchema objectSchema = new ObjectSchema ();
690
+ objectSchema .addProperties ("street" , new StringSchema ());
691
+
692
+ Schema schema = new Schema ();
693
+ schema .addProperties ("address" , objectSchema );
694
+ schema .addProperties ("name" , new StringSchema ());
695
+
696
+ MediaType mediaType = new MediaType ();
697
+ mediaType .setSchema (schema );
698
+
699
+ Content content = new Content ();
700
+ content .addMediaType ("*/*" , mediaType );
701
+
702
+ RequestBody requestBody = new RequestBody ();
703
+ requestBody .setContent (content );
704
+
705
+ Operation operation = new Operation ();
706
+ operation .setRequestBody (requestBody );
707
+
708
+ PathItem pathItem = new PathItem ();
709
+ pathItem .setGet (operation );
710
+ openAPI .path ("/api/Cloud.Greet.Hello" ,pathItem );
711
+
712
+ new InlineModelResolver (true , true ).flatten (openAPI );
713
+
714
+ Operation getOperation = openAPI .getPaths ().get ("/api/Cloud.Greet.Hello" ).getGet ();
715
+ RequestBody body = getOperation .getRequestBody ();
716
+ assertEquals ("use dot as common word separator: as it occurs frequently on OData services" ,
717
+ "#/components/schemas/ApiCloudGreetHelloBody" ,
718
+ body .getContent ().get ("*/*" ).getSchema ().get$ref ());
719
+
720
+ Schema bodySchema = openAPI .getComponents ().getSchemas ().get ("ApiCloudGreetHelloBody" );
680
721
assertTrue (bodySchema instanceof Schema );
681
722
682
723
assertNotNull (bodySchema .getProperties ().get ("address" ));
@@ -805,9 +846,9 @@ public void resolveInlineArrayRequestBody() throws Exception {
805
846
Schema inner = am .getItems ();
806
847
assertTrue (inner .get$ref () != null );
807
848
808
- assertEquals ( "#/components/schemas/helloBody " ,inner .get$ref ());
849
+ assertEquals ( "#/components/schemas/hello_body " ,inner .get$ref ());
809
850
810
- Schema inline = openAPI .getComponents ().getSchemas ().get ("helloBody " );
851
+ Schema inline = openAPI .getComponents ().getSchemas ().get ("hello_body " );
811
852
assertNotNull (inline );
812
853
assertTrue (inline instanceof Schema );
813
854
@@ -1091,7 +1132,7 @@ public void testArbitraryObjectRequestBodyInline() {
1091
1132
RequestBody requestBody = operation .getRequestBody ();
1092
1133
assertTrue (requestBody .getContent ().get ("*/*" ).getSchema ().get$ref () != null );
1093
1134
1094
- Schema body = swagger .getComponents ().getSchemas ().get ("helloBody " );
1135
+ Schema body = swagger .getComponents ().getSchemas ().get ("hello_body " );
1095
1136
assertTrue (body instanceof Schema );
1096
1137
1097
1138
@@ -1153,9 +1194,9 @@ public void testArbitraryObjectBodyParamArrayInline() {
1153
1194
assertTrue (inner .get$ref () != null );
1154
1195
1155
1196
1156
- assertEquals (inner .get$ref (), "#/components/schemas/helloBody " );
1197
+ assertEquals (inner .get$ref (), "#/components/schemas/hello_body " );
1157
1198
1158
- Schema inline = openAPI .getComponents ().getSchemas ().get ("helloBody " );
1199
+ Schema inline = openAPI .getComponents ().getSchemas ().get ("hello_body " );
1159
1200
assertNotNull (inline );
1160
1201
1161
1202
Schema p = (Schema )inline .getProperties ().get ("arbitrary" );
0 commit comments