use of io.swagger.v3.oas.models.media.BinarySchema in project swagger-core by swagger-api.
the class ByteConverterTest method testReadOnlyByteArray.
@Test
public void testReadOnlyByteArray() {
Schema model = new Schema().addProperties("byteArray", new ArraySchema().items(new BinarySchema()).readOnly(true));
assertEquals(Json.pretty(model), "{" + NEWLINE + " \"properties\" : {" + NEWLINE + " \"byteArray\" : {" + NEWLINE + " \"type\" : \"array\"," + NEWLINE + " \"readOnly\" : true," + NEWLINE + " \"items\" : {" + NEWLINE + " \"type\" : \"string\"," + NEWLINE + " \"format\" : \"binary\"" + NEWLINE + " }" + NEWLINE + " }" + NEWLINE + " }" + NEWLINE + "}");
}
use of io.swagger.v3.oas.models.media.BinarySchema in project swagger-core by swagger-api.
the class ByteConverterTest method testByteArray.
@Test
public void testByteArray() {
Schema model = new Schema().addProperties("byteArray", new ArraySchema().items(new BinarySchema()));
assertEquals(Json.pretty(model), "{" + NEWLINE + " \"properties\" : {" + NEWLINE + " \"byteArray\" : {" + NEWLINE + " \"type\" : \"array\"," + NEWLINE + " \"items\" : {" + NEWLINE + " \"type\" : \"string\"," + NEWLINE + " \"format\" : \"binary\"" + NEWLINE + " }" + NEWLINE + " }" + NEWLINE + " }" + NEWLINE + "}");
}
use of io.swagger.v3.oas.models.media.BinarySchema in project swagger-parser by swagger-api.
the class OpenAPIDeserializerTest method testDeserializeBinaryString.
@Test
public void testDeserializeBinaryString() {
String yaml = "openapi: 3.0.0\n" + "servers: []\n" + "info:\n" + " title: foo\n" + " version: ''\n" + "paths:\n" + " /test:\n" + " post:\n" + " responses:\n" + " '200':\n" + " description: ok\n" + " requestBody:\n" + " content:\n" + " application/json:\n" + " schema:\n" + " type: string\n" + " format: binary";
OpenAPIV3Parser parser = new OpenAPIV3Parser();
SwaggerParseResult result = parser.readContents(yaml, null, null);
final OpenAPI resolved = new OpenAPIResolver(result.getOpenAPI(), null).resolve();
assertTrue(resolved.getPaths().get("/test").getPost().getRequestBody().getContent().get("application/json").getSchema() instanceof BinarySchema);
}
Aggregations