Skip to content

Commit a54bba6

Browse files
mma5997frantuma
authored andcommitted
Updated the test files as per PR changes
The requestBody is made inline same as its done for responses and thus we'd need to look for contents inside it and not for the ref.
1 parent 4c185fd commit a54bba6

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

modules/swagger-parser-v3/src/test/java/io/swagger/v3/parser/test/FileReferenceTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import io.swagger.v3.oas.models.PathItem;
99
import io.swagger.v3.oas.models.media.ArraySchema;
1010
import io.swagger.v3.oas.models.media.ComposedSchema;
11+
import io.swagger.v3.oas.models.media.ObjectSchema;
1112
import io.swagger.v3.oas.models.media.Schema;
1213
import io.swagger.v3.parser.OpenAPIV3Parser;
1314
import io.swagger.v3.parser.core.models.ParseOptions;
@@ -235,9 +236,9 @@ public void testIssue421() {
235236
assertNotNull(swagger.getPaths().get("/pet/{petId}").getPost().getParameters());
236237
assertTrue(swagger.getPaths().get("/pet/{petId}").getPost().getParameters().size() == 1);
237238
assertTrue(swagger.getPaths().get("/pet/{petId}").getPost().getRequestBody() != null);
238-
assertTrue(swagger.getPaths().get("/pet/{petId}").getPost().getRequestBody().get$ref() != null);
239-
assertEquals(swagger.getPaths().get("/pet/{petId}").getPost().getRequestBody().get$ref(),"#/components/requestBodies/requestBody");
240-
assertTrue(swagger.getPaths().get("/pet/{petId}").getPost().getRequestBody().get$ref().equals("#/components/requestBodies/requestBody"));
239+
assertTrue(swagger.getPaths().get("/pet/{petId}").getPost().getRequestBody().getContent() != null);
240+
assertTrue(swagger.getPaths().get("/pet/{petId}").getPost().getRequestBody().getContent().get("application/x-www-form-urlencoded") != null);
241+
assertTrue(swagger.getPaths().get("/pet/{petId}").getPost().getRequestBody().getContent().get("application/x-www-form-urlencoded").getSchema() instanceof ObjectSchema);
241242

242243
assertNotNull(swagger.getPaths().get("/store/order"));
243244
assertNotNull(swagger.getPaths().get("/store/order").getPost());

modules/swagger-parser-v3/src/test/java/io/swagger/v3/parser/test/OpenAPIResolverTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,9 @@ public void componentsResolver() throws Exception {
346346
// internal callback reference
347347
assertEquals(callbacks.get("referenced").get$ref(),"#/components/callbacks/failed");
348348
//callback pathItem -> operation ->requestBody
349-
assertEquals(callbacks.get("heartbeat").get("$request.query.heartbeat-url").getPost().getRequestBody().get$ref(),"#/components/requestBodies/requestBody3");
349+
assertTrue(callbacks.get("heartbeat").get("$request.query.heartbeat-url").getPost().getRequestBody().getContent() != null);
350+
assertTrue(callbacks.get("heartbeat").get("$request.query.heartbeat-url").getPost().getRequestBody().getContent().get("application/json").getSchema() instanceof ArraySchema);
351+
assertEquals(((ArraySchema) callbacks.get("heartbeat").get("$request.query.heartbeat-url").getPost().getRequestBody().getContent().get("application/json").getSchema()).getItems().get$ref(),"#/components/schemas/User");
350352
//remote callback ref
351353
assertEquals(callbacks.get("remoteCallback").get$ref(),"#/components/callbacks/callback");
352354

0 commit comments

Comments
 (0)