io.swagger.models.Tag类的使用及代码示例

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

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

Tag介绍

暂无

代码示例

代码示例来源:origin: jooby-project/jooby

Optional.ofNullable(swagger.getTag(value))
   .orElseGet(() -> {
    Tag tag = new Tag().name(value);
    swagger.addTag(tag);
    return tag;
   });
 Optional.ofNullable(swagger.getPath(pattern))
   .orElseGet(() -> {
    Path path = new Path();
tags.forEach(it -> op.addTag(it.getName()));

代码示例来源: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: 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: Swagger2Markup/swagger2markup

private String mapToString(Tag tag) {
  String name = tag.getName();
  String description = tag.getDescription();
  if (isNotBlank(description)) {
    return name + COLON + description;
  } else {
    return name;
  }
}

代码示例来源:origin: stackoverflow.com

try
{
  // Extract metadata.
  Metadata metadata = ImageMetadataReader.readMetadata(new BufferedInputStream(new ByteArrayInputStream(imageData)), imageData.length);

  // Log each directory.
  for(Directory directory : metadata.getDirectories())
  {
    Log.d("LOG", "Directory: " + directory.getName());

    // Log all errors.
    for(String error : directory.getErrors())
    {
      Log.d("LOG", "> error: " + error);
    }

    // Log all tags.
    for(Tag tag : directory.getTags())
    {
      Log.d("LOG", "> tag: " + tag.getTagName() + " = " + tag.getDescription());
    }
  }
}
catch(Exception e)
{
  // TODO: handle exception
}

代码示例来源:origin: Swagger2Markup/swagger2markup

@Test
  public void testTagsComponent() throws URISyntaxException {
    List<Tag> tags = new ArrayList<>();
    tags.add(new Tag().name("Tag1").description("description"));
    tags.add(new Tag().name("Tag2"));

    Swagger2MarkupConverter.Context context = createContext();
    MarkupDocBuilder markupDocBuilder = context.createMarkupDocBuilder();

    markupDocBuilder = new TagsComponent(context).apply(markupDocBuilder, TagsComponent.parameters(tags, OverviewDocument.SECTION_TITLE_LEVEL));
    markupDocBuilder.writeToFileWithoutExtension(outputDirectory, StandardCharsets.UTF_8);

    Path expectedFile = getExpectedFile(COMPONENT_NAME);
    DiffUtils.assertThatFileIsEqual(expectedFile, outputDirectory, getReportName(COMPONENT_NAME));

  }
}

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

protected void readSwaggerConfig(Class<?> cls, SwaggerDefinition config) {
    swagger.setBasePath(config.basePath());
    swagger.setHost(config.host());
      swagger.addConsumes(consume);
      Tag tag = new Tag();
      tag.setName(tagConfig.name());
      tag.setDescription(tagConfig.description());
        tag.setExternalDocs(
            new ExternalDocs(tagConfig.externalDocs().value(), tagConfig.externalDocs().url()));
      tag.getVendorExtensions().putAll(BaseReaderUtils.parseExtensions(tagConfig.extensions()));
      swagger.addTag(tag);

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

public Swagger getSwagger(final ZenModel model) {
 final Swagger swagger = new Swagger();
 final Function1<com.reprezen.rapidml.Extension, Boolean> _function = (com.reprezen.rapidml.Extension it) -> {
  return Boolean.valueOf(it.getName().startsWith("openAPI.tags."));
 if (_not) {
  final Consumer<com.reprezen.rapidml.Extension> _function_1 = (com.reprezen.rapidml.Extension it) -> {
   final Tag tag = new Tag();
   tag.setName(it.getName().substring(13));
   final String description = it.getValue();
   tag.setDescription(description);
   swagger.addTag(tag);
  };
  groups.forEach(_function_1);
  _xifexpression = "/";
 swagger.setBasePath(_xifexpression);
 String _host = uri.getHost();
 String _xifexpression_1 = null;
 };
 final Consumer<ResourceDefinition> _function_4 = (ResourceDefinition it) -> {
  final Tag tag = new Tag();
  tag.setName(it.getName());
  tag.setDescription(this._zenModelHelper.getDocumentation(it));
  swagger.addTag(tag);
  String _xifexpression_3 = null;

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

MessageContext ctx = createMessageContext();
String currentBasePath = StringUtils.substringBeforeLast(ctx.getHttpServletRequest().getRequestURI(), "/");
data.setBasePath(currentBasePath);
if (data.getHost() == null) {
  data.setHost(beanConfig.getHost());
if (data.getInfo() == null) {
    ClassResourceInfo cri = operations.get(entry.getKey());
    tag = new Tag();
    tag.setName(cri.getURITemplate().getValue().replaceAll("/", "_"));
    if (javadocProvider != null) {
      tag.setDescription(javadocProvider.getClassDoc(cri));
      subentry.getValue().setTags(Collections.singletonList(tag.getName()));

代码示例来源:origin: Valandur/Web-API

List<String> integrationTags = new ArrayList<>();
swagger.setTags(new ArrayList<>());
    for (String tag : tags) {
      webapiTags.add(tag);
      swagger.addTag(new io.swagger.models.Tag().name(tag).description(descr));
      swagger.addTag(new io.swagger.models.Tag().name(tag).description(descr));

代码示例来源:origin: buremba/netty-rest

if (!"".equals(tag)) {
    operation.tag(tag);
    swagger.tag(new Tag().name(tag));
Path path = swagger.getPath(operationPath);
if (path == null) {
  path = new Path();
  swagger.path(operationPath, path);

代码示例来源:origin: rakam-io/rakam

@Override
protected void setup(Binder binder) {
  Multibinder<HttpService> httpServices = Multibinder.newSetBinder(binder, HttpService.class);
  httpServices.addBinding().to(EventStreamHttpService.class);
  Multibinder<Tag> tags = Multibinder.newSetBinder(binder, Tag.class);
  tags.addBinding().toInstance(new Tag().name("event-stream").description("Event Stream Module").externalDocs(MetadataConfig.centralDocs));
}

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

operation.addTag(controller.getSimpleName());
} else {
  swagger.addTag(tag);
  operation.addTag(tag.getName());
String operationPath = StringUtils.removeStart(registerParameters(swagger, operation, route, method), swagger.getBasePath());
operationPath = stripContentTypeSuffixPattern(operationPath);
if (swagger.getPath(operationPath) == null) {
  swagger.path(operationPath, new Path());

代码示例来源:origin: vmware/admiral

.parameter(headerParameter));
expectedSwagger = new Swagger()
    .basePath("/")
    .host("host")
    .schemes(Arrays.asList(new Scheme[] {Scheme.HTTP}));
expectedSwagger.addDefinition("AnnotatedServiceDocumentMock", model);
expectedSwagger.tags(expectedTags.stream().map(tag -> new Tag().name(tag)).collect(Collectors.toList()));
expectedSwagger.path(PATH + "/{id}", getPath);
expectedSwagger.path(PATH + "/", postPath);

代码示例来源: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: dsukhoroslov/bagri

fullPath += paths.get(0);
Path path = swagger.getPath(fullPath);
if (path == null) {
  path = new Path();
swagger.path(fullPath, path);
logger.debug("afterScan; set path: {}", path.getOperations()); 
if (consumes != null) {
  for (String consume: consumes) {
    swagger.addConsumes(consume);
swagger.tag(new Tag().name(base.substring(1)));

代码示例来源: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: com.gitblit.fathom/fathom-rest-swagger

final String ref = modelTag.getName();
if (swagger.getDefinitions() != null && swagger.getDefinitions().containsKey(ref)) {
swagger.addDefinition(modelTag.getName(), model);
if (!Strings.isNullOrEmpty(modelTag.getDescription())) {
  model.setDescription(modelTag.getDescription());

代码示例来源: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: yahoo/elide

models.putAll(converters.readAll(clazz));
swagger.setDefinitions(models);
  swagger.path(pathDatum.getCollectionUrl(), pathDatum.getCollectionPath());
  swagger.path(pathDatum.getInstanceUrl(), pathDatum.getInstancePath());
    .map((alias) -> new Tag().name(alias))
    .collect(Collectors.toList());

相关文章