本文整理了Java中io.swagger.models.Response.example
方法的一些代码示例,展示了Response.example
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Response.example
方法的具体详情如下:
包路径:io.swagger.models.Response
类名称:Response
方法名:example
暂无
代码示例来源:origin: org.ballerinalang/ballerina-to-swagger
/**
* This method will convert ballerina @Resource to ballerina @OperationAdaptor.
*
* @param resource Resource array to be convert.
* @return Operation Adaptor object of given resource
*/
private OperationAdaptor convertResourceToOperation(BLangFunction resource, String httpMethod, int idIncrement) {
OperationAdaptor op = new OperationAdaptor();
if (resource != null) {
op.setHttpOperation(httpMethod);
op.setPath('/' + resource.getName().getValue());
Response response = new Response()
.description("Successful")
.example(MediaType.APPLICATION_JSON, "Ok");
op.getOperation().response(200, response);
// Replacing all '_' with ' ' to keep the consistency with what we are doing in swagger -> bal
// @see BallerinaOperation#buildContext
String resName = resource.getName().getValue().replaceAll("_", " ");
op.getOperation().setOperationId(getOperationId(idIncrement, resName));
op.getOperation().setParameters(null);
// Parsing annotations.
this.parseResourceConfigAnnotationAttachment(resource, op);
this.parseResourceInfo(resource, op.getOperation(), httpMethod);
this.addResourceParameters(resource, op);
this.parseResponsesAnnotationAttachment(resource, op.getOperation());
}
return op;
}
代码示例来源:origin: com.reprezen.genflow/rapidml-swagger
final MediaType type = IterableExtensions.<MediaType>head(rapidResponse.getMediaTypes());
if ((type != null)) {
swaggerResponse.example(IterableExtensions.<MediaType>head(rapidResponse.getMediaTypes()).getName(), this.renderExample(example.getBody(), type.getName()));
内容来源于网络,如有侵权,请联系作者删除!