io.swagger.models.Tag.setDescription()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(96)

本文整理了Java中io.swagger.models.Tag.setDescription()方法的一些代码示例,展示了Tag.setDescription()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tag.setDescription()方法的具体详情如下:
包路径:io.swagger.models.Tag
类名称:Tag
方法名:setDescription

Tag.setDescription介绍

暂无

代码示例

代码示例来源:origin: kongchen/swagger-maven-plugin

private void updateTagDescriptions(Map<String, Tag> discoveredTags) {
  if (swagger.getTags() != null) {
    for (Tag tag : swagger.getTags()) {
      Tag rightTag = discoveredTags.get(tag.getName());
      if (rightTag != null && rightTag.getDescription() != null) {
        tag.setDescription(rightTag.getDescription());
      }
    }
  }
}

代码示例来源:origin: apache/servicecomb-java-chassis

private Tag convertTag(io.swagger.annotations.Tag tagAnnotation) {
 Tag tag = new Tag();
 tag.setName(tagAnnotation.name());
 tag.setDescription(tagAnnotation.description());
 tag.setExternalDocs(convertExternalDocs(tagAnnotation.externalDocs()));
 tag.getVendorExtensions().putAll(BaseReaderUtils.parseExtensions(tagAnnotation.extensions()));
 return tag;
}

代码示例来源:origin: io.swagger/swagger-models

public Tag description(String description) {
  setDescription(description);
  return this;
}

代码示例来源:origin: com.github.phillip-kruger/apiee-core

private List<Tag> toTagList(List<Tag> original,String tags) {
  List<Tag> tagList = new ArrayList<>();
  
  for(String tag:toList(tags)){
    Tag t = new Tag();
    if(tag.contains(DOUBLE_POINT)){
      String[] nameAndDesc = tag.split(DOUBLE_POINT);
      t.setName(nameAndDesc[0]);
      t.setDescription(nameAndDesc[1]);
    }else{
      t.setName(tag);
    }
    
    tagList.add(t);
  }
  
  if(original!=null){
    original.addAll(tagList);
    return original;
  }else{
    return tagList;
  }
}

代码示例来源:origin: SciGraph/SciGraph

private byte[] writeDynamicResource(InputStream is) throws IOException {
 String str = CharStreams.toString(new InputStreamReader(is, Charsets.UTF_8));
 Swagger swagger = new SwaggerParser().parse(str);
 // set the resource listing tag
 Tag dynamic = new Tag();
 dynamic.setName("dynamic");
 dynamic.setDescription("Dynamic Cypher resources");
 swagger.addTag(dynamic);
 // add resources to the path
 Map<String,Path> paths = swagger.getPaths();
 paths.putAll(configuration.getCypherResources());
 Map<String,Path> sorted = new LinkedHashMap<>();
 List<String> keys = new ArrayList<>();
 keys.addAll(paths.keySet());
 Collections.sort(keys);
 for (String key : keys) {
  sorted.put(key, paths.get(key));
 }
 swagger.setPaths(sorted);
 // return updated swagger JSON
 return Json.pretty(swagger).getBytes();
}

代码示例来源:origin: com.gitblit.fathom/fathom-rest-swagger

/**
 * Returns the tag of the model.
 * This ref is either explicitly named or it is generated from the model class name.
 *
 * @param modelClass
 * @return the tag of the model
 */
protected Tag getModelTag(Class<?> modelClass) {
  if (modelClass.isAnnotationPresent(ApiModel.class)) {
    ApiModel annotation = modelClass.getAnnotation(ApiModel.class);
    Tag tag = new Tag();
    tag.setName(Optional.fromNullable(Strings.emptyToNull(annotation.name())).or(modelClass.getSimpleName()));
    tag.setDescription(translate(annotation.descriptionKey(), annotation.description()));
    return tag;
  }
  Tag tag = new Tag();
  tag.setName(modelClass.getName());
  return tag;
}

代码示例来源:origin: gitblit/fathom

/**
 * Returns the tag of the model.
 * This ref is either explicitly named or it is generated from the model class name.
 *
 * @param modelClass
 * @return the tag of the model
 */
protected Tag getModelTag(Class<?> modelClass) {
  if (modelClass.isAnnotationPresent(ApiModel.class)) {
    ApiModel annotation = modelClass.getAnnotation(ApiModel.class);
    Tag tag = new Tag();
    tag.setName(Optional.fromNullable(Strings.emptyToNull(annotation.name())).or(modelClass.getSimpleName()));
    tag.setDescription(translate(annotation.descriptionKey(), annotation.description()));
    return tag;
  }
  Tag tag = new Tag();
  tag.setName(modelClass.getName());
  return tag;
}

代码示例来源:origin: org.ballerinalang/ballerina-to-swagger

/**
 * Creates tag swagger definition.
 *
 * @param annotationExpression The ballerina annotation attribute value for tag.
 * @param swagger              The swagger definition which the tags needs to be build on.
 */
private void createTagModel(BLangExpression annotationExpression, Swagger swagger) {
  if (null != annotationExpression) {
    List<Tag> tags = new LinkedList<>();
    BLangArrayLiteral tagArray = (BLangArrayLiteral) annotationExpression;
    for (ExpressionNode expr : tagArray.getExpressions()) {
      List<BLangRecordKeyValue> tagList = ((BLangRecordLiteral) expr).getKeyValuePairs();
      Map<String, BLangExpression> tagAttributes = ConverterUtils.listToMap(tagList);
      Tag tag = new Tag();
      if (tagAttributes.containsKey(ConverterConstants.ATTR_NAME)) {
        tag.setName(ConverterUtils.getStringLiteralValue(tagAttributes.get(ConverterConstants.ATTR_NAME)));
      }
      if (tagAttributes.containsKey(ConverterConstants.ATTR_DESCRIPTION)) {
        tag.setDescription(ConverterUtils
            .getStringLiteralValue(tagAttributes.get(ConverterConstants.ATTR_DESCRIPTION)));
      }
      tags.add(tag);
    }
    swagger.setTags(Lists.reverse(tags));
  }
}

代码示例来源:origin: com.gitblit.fathom/fathom-rest-swagger

/**
 * Returns the Tag for a controller.
 *
 * @param controllerClass
 * @return a controller tag or null
 */
protected Tag getControllerTag(Class<? extends Controller> controllerClass) {
  if (controllerClass.isAnnotationPresent(ApiOperations.class)) {
    ApiOperations annotation = controllerClass.getAnnotation(ApiOperations.class);
    io.swagger.models.Tag tag = new io.swagger.models.Tag();
    tag.setName(Optional.fromNullable(Strings.emptyToNull(annotation.tag())).or(controllerClass.getSimpleName()));
    tag.setDescription(translate(annotation.descriptionKey(), annotation.description()));
    if (!Strings.isNullOrEmpty(annotation.externalDocs())) {
      ExternalDocs docs = new ExternalDocs();
      docs.setUrl(annotation.externalDocs());
      tag.setExternalDocs(docs);
    }
    if (!Strings.isNullOrEmpty(tag.getDescription())) {
      return tag;
    }
  }
  return null;
}

代码示例来源:origin: gitblit/fathom

/**
 * Returns the Tag for a controller.
 *
 * @param controllerClass
 * @return a controller tag or null
 */
protected Tag getControllerTag(Class<? extends Controller> controllerClass) {
  if (controllerClass.isAnnotationPresent(ApiOperations.class)) {
    ApiOperations annotation = controllerClass.getAnnotation(ApiOperations.class);
    io.swagger.models.Tag tag = new io.swagger.models.Tag();
    tag.setName(Optional.fromNullable(Strings.emptyToNull(annotation.tag())).or(controllerClass.getSimpleName()));
    tag.setDescription(translate(annotation.descriptionKey(), annotation.description()));
    if (!Strings.isNullOrEmpty(annotation.externalDocs())) {
      ExternalDocs docs = new ExternalDocs();
      docs.setUrl(annotation.externalDocs());
      tag.setExternalDocs(docs);
    }
    if (!Strings.isNullOrEmpty(tag.getDescription())) {
      return tag;
    }
  }
  return null;
}

代码示例来源:origin: org.apache.servicecomb/swagger-generator-core

private Tag convertTag(io.swagger.annotations.Tag tagAnnotation) {
 Tag tag = new Tag();
 tag.setName(tagAnnotation.name());
 tag.setDescription(tagAnnotation.description());
 tag.setExternalDocs(convertExternalDocs(tagAnnotation.externalDocs()));
 tag.getVendorExtensions().putAll(BaseReaderUtils.parseExtensions(tagAnnotation.extensions()));
 return tag;
}

代码示例来源:origin: apache/cxf

tag.setName(cri.getURITemplate().getValue().replaceAll("/", "_"));
if (javadocProvider != null) {
  tag.setDescription(javadocProvider.getClassDoc(cri));

代码示例来源:origin: com.reprezen.genflow/rapidml-swagger

tag.setName(it.getName().substring(13));
 final String description = it.getValue();
 tag.setDescription(description);
 swagger.addTag(tag);
};
final Tag tag = new Tag();
tag.setName(it.getName());
tag.setDescription(this._zenModelHelper.getDocumentation(it));
swagger.addTag(tag);
String _xifexpression_3 = null;

代码示例来源:origin: wso2/msf4j

Tag tag = new Tag();
tag.setName(tagConfig.name());
tag.setDescription(tagConfig.description());

代码示例来源:origin: org.wso2.msf4j/msf4j-swagger

Tag tag = new Tag();
tag.setName(tagConfig.name());
tag.setDescription(tagConfig.description());

代码示例来源:origin: Sayi/swagger-dubbo

final Tag tag = new Tag();
tag.setName(tagConfig.name());
tag.setDescription(tagConfig.description());

代码示例来源:origin: io.swagger/swagger-jaxrs

Tag tag = new Tag();
tag.setName(tagConfig.name());
tag.setDescription(tagConfig.description());

代码示例来源:origin: noboomu/proteus

Tag tag = new Tag();
tag.setName(tagConfig.name());
tag.setDescription(tagConfig.description());

代码示例来源:origin: javagossip/dorado

Tag tag = new Tag();
tag.setName(tagConfig.name());
tag.setDescription(tagConfig.description());

相关文章