Refine search
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; }
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()); } } } }
private String mapToString(Tag tag) { String name = tag.getName(); String description = tag.getDescription(); if (isNotBlank(description)) { return name + COLON + description; } else { return name; } }
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 }
@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)); } }
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);
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;
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()));
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));
@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)); }
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());
.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);
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(); }
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)));
/** * 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; }
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());
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; } }
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());