Java Code Examples for io.swagger.models.Operation#summary()

The following examples show how to use io.swagger.models.Operation#summary() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PostOperationGenerator.java    From yang2swagger with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public Operation execute(DataSchemaNode node) {
    final Operation post = dropLastSegmentParameters ? listOperation() : defaultOperation();
    final RefModel definition = new RefModel(getDefinitionId(node));
    post.summary("creates " + getName(node));
    String description = node.getDescription() == null ? "creates " + getName(node) :
            node.getDescription();
    post.description(description);
    post.parameter(new BodyParameter()
            .name(getName(node) + ".body-param")
            .schema(definition)
            .description(getName(node) + " to be added to list"));

    post.response(201, new Response().description("Object created"));
    post.response(409, new Response().description("Object already exists"));
    return post;
}
 
Example 2
Source File: PutOperationGenerator.java    From yang2swagger with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public Operation execute(DataSchemaNode node) {
    final Operation put = defaultOperation();
    final RefModel definition = new RefModel(getDefinitionId(node));
    put.summary("creates or updates " + getName(node));
    String description = node.getDescription() == null ? "creates or updates " + getName(node) :
            node.getDescription();
    put.description(description);
    put.parameter(new BodyParameter()
            .name(getName(node) + ".body-param")
            .schema(definition)
            .description(getName(node) + " to be added or updated"));

    put.response(201, new Response().description("Object created"));
    put.response(204, new Response().description("Object modified"));
    return put;
}
 
Example 3
Source File: PatchOperationGenerator.java    From yang2swagger with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public Operation execute(DataSchemaNode node) {
    final Operation patch = defaultOperation();
    final RefModel definition = new RefModel(getDefinitionId(node));
    patch.summary("patches " + getName(node));
    String description = node.getDescription() == null ? "patches " + getName(node) :
            node.getDescription();
    patch.description(description);
    patch.parameter(new BodyParameter()
            .name(getName(node) + ".body-param")
            .schema(definition)
            .description(getName(node) + " to be added or updated"));

    patch.response(200, new Response()
            .schema(new RefProperty(getDefinitionId(node)))
            .description(getName(node)));
    patch.response(204, new Response().description("Operation successful"));
    return patch;
}
 
Example 4
Source File: RpcReaderExtension.java    From sofa-rpc with Apache License 2.0 5 votes vote down vote up
@Override
public void applySummary(Operation operation, Method method) {
    final ApiOperation apiOperation = ReflectionUtils.getAnnotation(method, ApiOperation.class);
    if (apiOperation != null && StringUtils.isNotBlank(apiOperation.value())) {
        operation.summary(apiOperation.value());
    }

}
 
Example 5
Source File: DubboReaderExtension.java    From swagger-dubbo with Apache License 2.0 5 votes vote down vote up
@Override
public void applySummary(Operation operation, Method method) {
	final ApiOperation apiOperation = ReflectionUtils.getAnnotation(method, ApiOperation.class);
	if (apiOperation != null && StringUtils.isNotBlank(apiOperation.value())) {
		operation.summary(apiOperation.value());
	}

}
 
Example 6
Source File: DeleteOperationGenerator.java    From yang2swagger with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public Operation execute(DataSchemaNode node) {
    final Operation delete = defaultOperation();
    delete.summary("removes " + getName(node));
    String description = node.getDescription() == null ? "removes " + getName(node) :
            node.getDescription();
    delete.description(description);
    delete.response(204, new Response().description("Object deleted"));
    return delete;
}
 
Example 7
Source File: GetOperationGenerator.java    From yang2swagger with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public Operation execute(DataSchemaNode node) {
    final Operation get = defaultOperation();
    get.summary("returns " + getName(node));
    String description = node.getDescription() == null ? "returns " + getName(node) :
            node.getDescription();
    get.description(description);
    get.response(200, new Response()
            .schema(new RefProperty(getDefinitionId(node)))
            .description(getName(node)));
    return get;
}