本文整理了Java中io.swagger.models.Tag.<init>()
方法的一些代码示例,展示了Tag.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tag.<init>()
方法的具体详情如下:
包路径:io.swagger.models.Tag
类名称:Tag
方法名:<init>
暂无
代码示例来源: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: jooby-project/jooby
Optional.ofNullable(swagger.getTag(value))
.orElseGet(() -> {
Tag tag = new Tag().name(value);
swagger.addTag(tag);
return tag;
代码示例来源:origin: rakam-io/rakam
@Override
protected void setup(Binder binder) {
Multibinder<Tag> tags = Multibinder.newSetBinder(binder, Tag.class);
tags.addBinding().toInstance(new Tag().name("collect").description("Collect data").externalDocs(MetadataConfig.centralDocs));
Multibinder<HttpService> httpServices = Multibinder.newSetBinder(binder, HttpService.class);
httpServices.addBinding().to(EventCollectionHttpService.class);
Multibinder.newSetBinder(binder, EventMapper.class);
httpServices.addBinding().to(AdminHttpService.class);
httpServices.addBinding().to(ProjectHttpService.class);
}
}
代码示例来源:origin: rakam-io/rakam
@Override
protected void setup(Binder binder) {
Multibinder<HttpService> httpServices = Multibinder.newSetBinder(binder, HttpService.class);
httpServices.addBinding().to(EventExplorerHttpService.class);
Multibinder<EventMapper> timeMapper = Multibinder.newSetBinder(binder, EventMapper.class);
timeMapper.permitDuplicates().addBinding().to(TimestampEventMapper.class).in(Scopes.SINGLETON);
Multibinder<Tag> tags = Multibinder.newSetBinder(binder, Tag.class);
tags.addBinding().toInstance(new Tag().name("event-explorer").description("Event Explorer").externalDocs(MetadataConfig.centralDocs));
binder.bind(EventExplorerListener.class).asEagerSingleton();
}
代码示例来源:origin: rakam-io/rakam
@Override
protected void setup(Binder binder) {
Multibinder<HttpService> httpServices = Multibinder.newSetBinder(binder, HttpService.class);
httpServices.addBinding().to(RetentionAnalyzerHttpService.class);
Multibinder<Tag> tags = Multibinder.newSetBinder(binder, Tag.class);
tags.addBinding().toInstance(new Tag().name("retention")
.description("Retention Analyzer module").externalDocs(MetadataConfig.centralDocs));
// binder.bind(RetentionAnalyzerListener.class).asEagerSingleton();
}
代码示例来源: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: rakam-io/rakam
@Override
protected void setup(Binder binder) {
Multibinder<HttpService> httpServices = Multibinder.newSetBinder(binder, HttpService.class);
httpServices.addBinding().to(ABTestingHttpService.class);
Multibinder<Tag> tags = Multibinder.newSetBinder(binder, Tag.class);
tags.addBinding().toInstance(new Tag().name("ab-testing").description("A/B Testing Module").externalDocs(MetadataConfig.centralDocs));
}
代码示例来源:origin: rakam-io/rakam
@Override
protected void setup(Binder binder) {
Multibinder<HttpService> httpServices = Multibinder.newSetBinder(binder, HttpService.class);
httpServices.addBinding().to(FunnelAnalyzerHttpService.class);
Multibinder<Tag> tags = Multibinder.newSetBinder(binder, Tag.class);
tags.addBinding().toInstance(new Tag().name("funnel").description("Funnel Analyzer").externalDocs(MetadataConfig.centralDocs));
}
代码示例来源:origin: rakam-io/rakam
@Override
protected void setup(Binder binder) {
bindConfig(binder).to(RealTimeConfig.class);
Multibinder<HttpService> multiBinder = Multibinder.newSetBinder(binder, HttpService.class);
multiBinder.addBinding().to(RealTimeHttpService.class);
Multibinder<EventMapper> mappers = Multibinder.newSetBinder(binder, EventMapper.class);
mappers.permitDuplicates().addBinding().to(TimestampEventMapper.class);
mappers.addBinding().to(RealtimeEventProcessor.class).in(Scopes.SINGLETON);
Multibinder.newSetBinder(binder, Tag.class).addBinding()
.toInstance(new Tag().name("realtime").description("Realtime")
.externalDocs(MetadataConfig.centralDocs));
}
代码示例来源:origin: kongchen/swagger-maven-plugin
private Map<String, Tag> scanClasspathForTags() {
Map<String, Tag> tags = new HashMap<>();
for (Class<?> aClass: new Reflections("").getTypesAnnotatedWith(SwaggerDefinition.class)) {
SwaggerDefinition swaggerDefinition = AnnotationUtils.findAnnotation(aClass, SwaggerDefinition.class);
for (io.swagger.annotations.Tag tag : swaggerDefinition.tags()) {
String tagName = tag.name();
if (!tagName.isEmpty()) {
tags.put(tag.name(), new Tag().name(tag.name()).description(tag.description()));
}
}
}
return tags;
}
代码示例来源:origin: kongchen/swagger-maven-plugin
protected Set<Tag> extractTags(Api api) {
Set<Tag> output = new LinkedHashSet<>();
if(api == null) {
return output;
}
boolean hasExplicitTags = false;
for (String tag : api.tags()) {
if (!tag.isEmpty()) {
hasExplicitTags = true;
output.add(new Tag().name(tag));
}
}
if (!hasExplicitTags) {
// derive tag from api path + description
String tagString = api.value().replace("/", "");
if (!tagString.isEmpty()) {
Tag tag = new Tag().name(tagString);
if (!api.description().isEmpty()) {
tag.description(api.description());
}
output.add(tag);
}
}
return output;
}
代码示例来源:origin: rakam-io/rakam
.toInstance(new Tag().name("user").description("User")
.externalDocs(MetadataConfig.centralDocs));
tagMultibinder.addBinding()
.toInstance(new Tag().name("user-action").description("User Action")
.externalDocs(MetadataConfig.centralDocs));
代码示例来源:origin: kongchen/swagger-maven-plugin
protected void updateTagsForOperation(Operation operation, ApiOperation apiOperation) {
if (apiOperation == null) {
return;
}
for (String tag : apiOperation.tags()) {
if (!tag.isEmpty()) {
operation.tag(tag);
swagger.tag(new Tag().name(tag));
}
}
}
代码示例来源:origin: rakam-io/rakam
.toInstance(new Tag().name("recipe").description("Recipe")
.externalDocs(MetadataConfig.centralDocs));
代码示例来源:origin: rakam-io/rakam
tags.addBinding().toInstance(new Tag().name("admin").description("System related actions").externalDocs(MetadataConfig.centralDocs));
tags.addBinding().toInstance(new Tag().name("query").description("Analyze data").externalDocs(MetadataConfig.centralDocs));
tags.addBinding().toInstance(new Tag().name("materialized-view").description("Materialized view").externalDocs(MetadataConfig.centralDocs));
代码示例来源: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: vmware/admiral
/**
* Return a list of {@link Tag} objects created from the {@link Api#tags()} property.
*
* @param clazz The annotated service class
* @return A list of {@link Tag} objects
*/
public static List<Tag> getApiTagsAsList(Class<?> clazz) {
return Arrays.asList(clazz.getAnnotation(Api.class).tags())
.stream()
.map(tag -> new Tag().name(tag))
.collect(Collectors.toList());
}
代码示例来源:origin: outbrain/ob1k
private Tag buildTag(final Class<?> serviceClass) {
final Api annotation = serviceClass.getAnnotation(Api.class);
final String name = (annotation != null) ? annotation.value() : serviceClass.getSimpleName();
final String description = (annotation != null) ? annotation.description() : serviceClass.getCanonicalName();
return new Tag().name(name).description(description);
}
代码示例来源:origin: vmware/admiral
@Test
public void testGetApiTagsAsList() {
List<Tag> actualTags = SwaggerDocumentationUtils.getApiTagsAsList(AnnotatedServiceMock.class);
List<Tag> expectedTags = new ArrayList<>();
expectedTags.add(new Tag().name(API_TAG));
Assert.assertEquals(expectedTags, actualTags);
}
代码示例来源: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;
}
内容来源于网络,如有侵权,请联系作者删除!