本文整理匯總了Java中io.swagger.util.Json.prettyPrint方法的典型用法代碼示例。如果您正苦於以下問題:Java Json.prettyPrint方法的具體用法?Java Json.prettyPrint怎麽用?Java Json.prettyPrint使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類io.swagger.util.Json
的用法示例。
在下文中一共展示了Json.prettyPrint方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testReadJson
import io.swagger.util.Json; //導入方法依賴的package包/類
public static void testReadJson() {
Swagger swagger = read("http://petstore.swagger.io/v2/swagger.json");
if (swagger != null) {
Json.prettyPrint(swagger);
Yaml.prettyPrint(swagger);
}
}
示例2: testReadPath
import io.swagger.util.Json; //導入方法依賴的package包/類
public static void testReadPath() throws JsonProcessingException, IOException {
String data = "{"
+ "\"post\": { \"tags\": [\"pet\"], \"summary\": \"add a new pet to the store\", \"description\": \"\", \"operationid\": \"addpet\", \"consumes\": [\"application/json\", \"application/xml\"], \"produces\": [\"application/xml\", \"application/json\"], \"parameters\": [{ \"in\": \"body\", \"name\": \"body\", \"description\": \"pet object that needs to be added to the store\", \"required\": true, \"schema\": { \"$ref\": \"#/definitions/pet\" } }], \"responses\": { \"405\": { \"description\": \"invalid input\" } }, \"security\": [{ \"petstore_auth\": [\"write:pets\", \"read:pets\"] }] },"
+ "\"put\": { \"tags\": [\"pet\"], \"summary\": \"update an existing pet\", \"description\": \"\", \"operationid\": \"updatepet\", \"consumes\": [\"application/json\", \"application/xml\"], \"produces\": [\"application/xml\", \"application/json\"], \"parameters\": [{ \"in\": \"body\", \"name\": \"body\", \"description\": \"pet object that needs to be added to the store\", \"required\": true, \"schema\": { \"$ref\": \"#/definitions/pet\" } }], \"responses\": { \"400\": { \"description\": \"invalid id supplied\" }, \"404\": { \"description\": \"pet not found\" }, \"405\": { \"description\": \"validation exception\" } }, \"security\": [{ \"petstore_auth\": [\"write:pets\", \"read:pets\"] }] }"
+ "}";
ObjectMapper mapper = Json.mapper();
JsonNode pathNode = mapper.readTree(data);
Path path = mapper.convertValue(pathNode, Path.class);
Json.prettyPrint(path);
}
示例3: testConversions
import io.swagger.util.Json; //導入方法依賴的package包/類
@Test
public void testConversions() {
final URI uri = URI.create("https://github.com/eclipse/vert.x/blob/a30703379a06502faaae0aeda1eaa9a9b1152004/src/main/java/io/vertx/core/net/impl/SSLHelper.java");
final RequestOptions requestOptions = Conversions.toRequestOptions(uri);
Json.prettyPrint(requestOptions);
}
示例4: testConversionsWithEscapedDataQuery
import io.swagger.util.Json; //導入方法依賴的package包/類
@Test
public void testConversionsWithEscapedDataQuery() {
final URI uri = URI.create("https://encrypted.google.com/search?q=face+book+%25+prime+%3F&oq=face+book+%25+prime+%3F&gs_l=psy-ab.3..0i13k1l10.12446.12733.0.13108.2.2.0.0.0.0.140.248.0j2.2.0....0...1.1.64.psy-ab..0.2.246....0.QRedmYd5GAY");
final RequestOptions requestOptions = Conversions.toRequestOptions(uri);
Json.prettyPrint(requestOptions);
}
示例5: testConversionsWithQuery
import io.swagger.util.Json; //導入方法依賴的package包/類
@Test
public void testConversionsWithQuery() {
final URI uri = URI.create("https://news.google.com/news/?ned=ca&hl=en-CA");
final RequestOptions requestOptions = Conversions.toRequestOptions(uri);
Json.prettyPrint(requestOptions);
}
示例6: testReadYaml
import io.swagger.util.Json; //導入方法依賴的package包/類
public static void testReadYaml() {
Swagger swagger = read("http://petstore.swagger.io/v2/swagger.yaml");
if (swagger != null) {
Json.prettyPrint(swagger);
Yaml.prettyPrint(swagger);
}
}
示例7: testSwaggerBasic
import io.swagger.util.Json; //導入方法依賴的package包/類
@Test
public void testSwaggerBasic(){
SwaggerBuilder builder = new SwaggerBuilder();
builder.withInfo().withTitle("Test Title").withVersion("1.0");
ResponseBuilder responseBuilder = new ResponseBuilder();
responseBuilder.withDescription("200 description");
responseBuilder.withSchema(new RefPropertyBuilder().withReferenceTo("TestRef"));
builder.withPath("/conclusion").withGet().withTags(Arrays.asList("Test")).withResponse("200", responseBuilder);
ModelBuilder mBuilder = builder.withModelDefinition("TestRef");
mBuilder.withReferencePropertyNamed("DefTestRef").withReferenceTo("some reference");
mBuilder.withStringPropertyNamed("TestModelProperty").withExample("myexample").withFormat("myformat");
mBuilder.withStringPropertyNamed("secondProperty").withExample("secondExample");
IntegerProperty intProperty = new IntegerProperty();
intProperty.example(10);
intProperty.setDescription("IntegerTest");
mBuilder.withArrayProperty("arrayProperty").withItems(intProperty);
RefPropertyBuilder refBuilder = new RefPropertyBuilder().withReferenceTo("finalArrayRef");
mBuilder.withArrayProperty("refArrayProperty").withItems(refBuilder.build());
Swagger swagger = builder.build();
Json.prettyPrint(swagger);
}