当前位置: 首页>>代码示例>>Java>>正文


Java Json.prettyPrint方法代码示例

本文整理汇总了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);
	}		
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:8,代码来源:SwaggerUtils.java

示例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);
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:11,代码来源:SwaggerUtils.java

示例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);

}
 
开发者ID:trajano,项目名称:app-ms,代码行数:9,代码来源:RequestOptionsTest.java

示例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);

}
 
开发者ID:trajano,项目名称:app-ms,代码行数:9,代码来源:RequestOptionsTest.java

示例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);

}
 
开发者ID:trajano,项目名称:app-ms,代码行数:9,代码来源:RequestOptionsTest.java

示例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);
	}		
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:8,代码来源:SwaggerUtils.java

示例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);
}
 
开发者ID:pegasystems,项目名称:api2swagger,代码行数:28,代码来源:TestSwaggerBuilders.java


注:本文中的io.swagger.util.Json.prettyPrint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。