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


Java Json.pretty方法代码示例

本文整理汇总了Java中io.swagger.util.Json.pretty方法的典型用法代码示例。如果您正苦于以下问题:Java Json.pretty方法的具体用法?Java Json.pretty怎么用?Java Json.pretty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.swagger.util.Json的用法示例。


在下文中一共展示了Json.pretty方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testGenerateSimepleString

import io.swagger.util.Json; //导入方法依赖的package包/类
@Test	
public void testGenerateSimepleString(){
	SwaggerModelGenerator generator = new SwaggerModelGenerator();
	
	String inputJson = "{\r\n\"Error\": \"Specified Node ID is invalid\"\r\n}";
	Map<String, ModelBuilder> output = generator.generate("error", inputJson);
	
	String finalSwaggerJson = Json.pretty(getSwagger("Test", output));
	System.out.println(finalSwaggerJson);
}
 
开发者ID:pegasystems,项目名称:api2swagger,代码行数:11,代码来源:TestSwaggerModelGenerator.java

示例2: testGenerateSimepleInteger

import io.swagger.util.Json; //导入方法依赖的package包/类
@Test	
public void testGenerateSimepleInteger(){
	SwaggerModelGenerator generator = new SwaggerModelGenerator();
	
	String inputJson = "{\r\n\"integer\": \"Specified Node ID is invalid\"\r\n}";
	Map<String, ModelBuilder> output = generator.generate("error", inputJson);
	
	String finalSwaggerJson = Json.pretty(getSwagger("Test", output));
	System.out.println(finalSwaggerJson);
}
 
开发者ID:pegasystems,项目名称:api2swagger,代码行数:11,代码来源:TestSwaggerModelGenerator.java

示例3: testGenerateSimepleInnerObject

import io.swagger.util.Json; //导入方法依赖的package包/类
@Test	
public void testGenerateSimepleInnerObject(){
	SwaggerModelGenerator generator = new SwaggerModelGenerator();
	
	String inputJson = "{\n  \"response\": {\n     \"error\":{\n          \"status\": \"success\"\n      },\n      \"code\" : 400 \n   } \n}";
	Map<String, ModelBuilder> output = generator.generate("innerObject", inputJson);
	
	String finalSwaggerJson = Json.pretty(getSwagger("Test", output));
	System.out.println(finalSwaggerJson);
}
 
开发者ID:pegasystems,项目名称:api2swagger,代码行数:11,代码来源:TestSwaggerModelGenerator.java

示例4: testGenerateSimepleMultipleObjects

import io.swagger.util.Json; //导入方法依赖的package包/类
@Test	
public void testGenerateSimepleMultipleObjects(){
	SwaggerModelGenerator generator = new SwaggerModelGenerator();
	
	String inputJson = "{\n  \"response\": {\n     \"error\":{\n          \"status\": \"success\"\n      },\n      \"code\" : 400 \n   },\n   \"prop1\": 123,\n   \"title\":\"Report\",\n   \"data\":{\n     \"name\":\"abcd\"\n   }   \n}";
	Map<String, ModelBuilder> output = generator.generate("multipleObjects", inputJson);
	
	String finalSwaggerJson = Json.pretty(getSwagger("Test", output));
	System.out.println(finalSwaggerJson);
}
 
开发者ID:pegasystems,项目名称:api2swagger,代码行数:11,代码来源:TestSwaggerModelGenerator.java

示例5: testGenerateSimepleSclarArrayObject

import io.swagger.util.Json; //导入方法依赖的package包/类
@Test	
public void testGenerateSimepleSclarArrayObject(){
	SwaggerModelGenerator generator = new SwaggerModelGenerator();
	
	String inputJson = "{\n  \"response\": [\"A\", \"b\"]\n}";
	Map<String, ModelBuilder> output = generator.generate("arrayObject", inputJson);
	
	String finalSwaggerJson = Json.pretty(getSwagger("Test", output));
	System.out.println(finalSwaggerJson);
}
 
开发者ID:pegasystems,项目名称:api2swagger,代码行数:11,代码来源:TestSwaggerModelGenerator.java

示例6: preprocessSwagger

import io.swagger.util.Json; //导入方法依赖的package包/类
@Override
public void preprocessSwagger(Swagger swagger) {
    super.preprocessSwagger(swagger);

    // add full swagger definition in a mustache parameter
    String swaggerDef = Json.pretty(swagger);
    this.additionalProperties.put("fullSwagger", swaggerDef);

    // add server port from the swagger file, 8080 by default
    String host = swagger.getHost();
    String port = extractPortFromHost(host);
    this.additionalProperties.put("serverPort", port);

    // retrieve api version from swagger file, 1.0.0-SNAPSHOT by default
    if (swagger.getInfo() != null && swagger.getInfo().getVersion() != null)
        artifactVersion = apiVersion = swagger.getInfo().getVersion();
    else
        artifactVersion = apiVersion;

    // manage operation & custom serviceId
    Map<String, Path> paths = swagger.getPaths();
    if (paths != null) {
        for (Entry<String, Path> entry : paths.entrySet()) {
            manageOperationNames(entry.getValue(), entry.getKey());
        }
    }
}
 
开发者ID:phiz71,项目名称:vertx-swagger,代码行数:28,代码来源:JavaVertXServerGenerator.java

示例7: prettyPrintJson

import io.swagger.util.Json; //导入方法依赖的package包/类
public static String prettyPrintJson(Swagger swagger) {
	return Json.pretty(swagger);
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:4,代码来源:SwaggerUtils.java

示例8: createJSONfromPojo

import io.swagger.util.Json; //导入方法依赖的package包/类
private String createJSONfromPojo(Object pojo) throws IOException {
	return Json.pretty(pojo);
}
 
开发者ID:WASdev,项目名称:tool.swagger.docgen,代码行数:4,代码来源:SwaggerProcessor.java

示例9: arrayModelBuilder

import io.swagger.util.Json; //导入方法依赖的package包/类
@Test
public void arrayModelBuilder(){
	Map<String, ModelBuilder> output = new HashMap<>();
	
	ModelBuilder builder = new ModelBuilder();
	builder.withArrayProperty("ArrayStringType").withItems(new StringPropertyBuilder().withExample("Test").build());
	
	output.put("ArrayBuilder", builder);
	
	
	String finalSwaggerJson = Json.pretty(getSwagger("Test", output));
	
	System.out.println(finalSwaggerJson);
}
 
开发者ID:pegasystems,项目名称:api2swagger,代码行数:15,代码来源:TestSwaggerModelGenerator.java

示例10: generateJSON

import io.swagger.util.Json; //导入方法依赖的package包/类
/**
 * Generates a Swagger 2.0 JSON specification from the collection of routes.
 *
 * @param routes
 * @return a Swagger 2.0 JSON specification
 */
public String generateJSON(Collection<Route> routes) {
    Swagger swagger = build(routes);
    String json = Json.pretty(swagger);
    return json;
}
 
开发者ID:gitblit,项目名称:fathom,代码行数:12,代码来源:SwaggerBuilder.java

示例11: getDocument

import io.swagger.util.Json; //导入方法依赖的package包/类
/**
 * @param swagger Swagger-Core swagger POJO
 * @return Pretty printed 'Swagger' document in JSON.
 */
public static String getDocument(Swagger swagger) {
    return Json.pretty(swagger);
}
 
开发者ID:yahoo,项目名称:elide,代码行数:8,代码来源:SwaggerBuilder.java


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