本文整理汇总了Java中io.swagger.models.Swagger.path方法的典型用法代码示例。如果您正苦于以下问题:Java Swagger.path方法的具体用法?Java Swagger.path怎么用?Java Swagger.path使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.swagger.models.Swagger
的用法示例。
在下文中一共展示了Swagger.path方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: correctResponsesHavePaths
import io.swagger.models.Swagger; //导入方法依赖的package包/类
@Test
public void correctResponsesHavePaths() {
Response response = new Response();
Operation operation = new Operation();
operation.addResponse("200", response);
Path path = new Path();
path.set("get", operation);
Swagger swagger = new Swagger();
swagger.path("/base", path);
SwaggerUtils.correctResponses(swagger);
Assert.assertEquals("response of 200", response.getDescription());
}
示例2: createSwagger
import io.swagger.models.Swagger; //导入方法依赖的package包/类
private Swagger createSwagger(Operation operation) {
Path path = new Path();
path.setGet(operation);
path.setPost(operation);
path.setPut(operation);
Swagger swagger = new Swagger();
swagger.path("/test", path);
return swagger;
}
示例3: buildBundleServices
import io.swagger.models.Swagger; //导入方法依赖的package包/类
private void buildBundleServices(Swagger swagger) {
// GET
Operation get = new Operation();
get.addResponse("200", resp().description("Bundle of endpoints"));
get.addResponse("204", resp().description("Empty bundle"));
get.tag("2 : Bundle Management");
// DELETE
Operation delete = new Operation();
delete.addResponse("200", resp().description("Attempting to delete bundle"));
delete.tag("5 : Danger Zone");
// POST
Operation post = new Operation();
post.addResponse("200", resp().description("Add new endpoints or update them"));
post.addResponse("400", resp().description("Malformed bundle entity"));
post.tag("2 : Bundle Management");
// PUT
Operation put = new Operation();
put.addResponse("200", resp().description("Add a new bundle, will override previous bundle."));
put.addResponse("400", resp().description("Malformed bundle entity"));
put.tag("5 : Danger Zone");
swagger.path("/bundle", new Path()
.set("delete", delete)
.set("get", get)
.set("post", post)
.set("put", put));
}
示例4: buildSwaggerApiPath
import io.swagger.models.Swagger; //导入方法依赖的package包/类
public void buildSwaggerApiPath(Swagger swagger, Endpoint endpoint) {
Operation operation = new Operation();
operation.tag("API");
operation.consumes(endpoint.getConsumes());
io.swagger.models.Response response = new io.swagger.models.Response();
if (!StringUtils.isEmpty(endpoint.getData()))
buildSwaggerApiBodyParam(operation);
response.setDescription(endpoint.getResponse().getStatus().getReasonPhrase());
operation.addResponse(endpoint.getResponse().getStatus().toString(), response);
swagger.path(endpoint.getPath(), new Path().set(endpoint.getMethod().toString().toLowerCase(), operation));
}
示例5: buildEndpointServices
import io.swagger.models.Swagger; //导入方法依赖的package包/类
private void buildEndpointServices(Swagger swagger) {
BodyParameter bodyParameter = new BodyParameter().name("Body").description("Endpoint entity");
bodyParameter.setRequired(true);
// GET
Operation get = new Operation();
get.addParameter(new QueryParameter().name("method").required(true).description("Endpoint method").type("string"));
get.addParameter(new QueryParameter().name("path").required(true).description("Endpoint path").type("string"));
get.addResponse("200", resp().description("Requested endpoint"));
get.addResponse("400", resp().description("Malformed parameters"));
get.addResponse("404", resp().description("Bundle is empty"));
get.addResponse("404", resp().description("Endpoint does not exist"));
get.tag("1 : Endpoint Management");
//DELETE
Operation delete = new Operation();
delete.addParameter(new QueryParameter().name("method").required(true).description("Endpoint method").type("string"));
delete.addParameter(new QueryParameter().name("path").required(true).description("Endpoint path").type("string"));
delete.addResponse("200", resp().description("Attempting to delete endpoint"));
delete.addResponse("400", resp().description("Malformed parameters"));
delete.tag("5 : Danger Zone");
//POST
Operation post = new Operation();
post.addParameter(bodyParameter);
post.addResponse("200", resp().description("Update a existing endpoint"));
post.addResponse("400", resp().description("Malformed endpoint entity"));
post.addResponse("404", resp().description("Endpoint does not exist"));
post.tag("1 : Endpoint Management");
//PUT
Operation put = new Operation();
put.addParameter(bodyParameter);
put.addResponse("200", resp().description("Add new endpoint or update it"));
put.addResponse("400", resp().description("Malformed endpoint entity"));
put.tag("1 : Endpoint Management");
swagger.path("/endpoint", new Path()
.set("delete", delete)
.set("get", get)
.set("post", post)
.set("put", put));
}