adding asserts to issue#799
@@ -4,10 +4,12 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import io.swagger.v3.core.util.Yaml;
import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
+import io.swagger.v3.oas.models.media.ArraySchema;
import io.swagger.v3.oas.models.media.Schema;
import io.swagger.v3.oas.models.PathItem;
import io.swagger.v3.oas.models.media.Schema;
import io.swagger.v3.oas.models.parameters.Parameter;
+import io.swagger.v3.oas.models.parameters.RequestBody;
import io.swagger.v3.parser.core.models.ParseOptions;
import io.swagger.v3.parser.core.models.SwaggerParseResult;
import io.swagger.v3.core.util.Json;
@@ -153,6 +155,15 @@ public class OpenAPIParserTest {
OpenAPI openAPI = openApiParser.readLocation("issue799.json", null, options).getOpenAPI();
Assert.assertEquals(((Schema)openAPI.getComponents().getSchemas().get("v1beta3.Binding").getProperties().get("metadata")).get$ref(),"#/components/schemas/v1beta3.ObjectMeta");
+ RequestBody bodyParameter = openAPI.getPaths().get("/api/v1beta3/namespaces/{namespaces}/bindings").getPost().getRequestBody();
+ Assert.assertEquals( bodyParameter.getContent().get("*/*").getSchema().get$ref(), "#/components/schemas/v1beta3.Binding");
+ Assert.assertEquals( openAPI.getPaths().get("/api/v1beta3/namespaces/{namespaces}/componentstatuses/{name}").getGet().getResponses().get("200").getContent().get("application/json").getSchema().get$ref(), "#/components/schemas/v1beta3.ComponentStatus");
+ Assert.assertEquals( openAPI.getPaths().get("/api/v1beta3/namespaces/{namespaces}/componentstatuses").getGet().getResponses().get("200").getContent().get("application/json").getSchema().get$ref(), "#/components/schemas/v1beta3.ComponentStatusList");
+ Schema conditionsProperty = (Schema) openAPI.getComponents().getSchemas().get("v1beta3.ComponentStatus").getProperties().get("conditions");
+ Assert.assertTrue( conditionsProperty instanceof ArraySchema);
+ Schema items = ((ArraySchema)conditionsProperty).getItems();
+ Assert.assertTrue( items.get$ref() != null);
+ Assert.assertEquals( items.get$ref(), "#/components/schemas/v1beta3.ObjectReference");
}
