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; }
public Tag name(String name) { setName(name); return this; }
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; } }
/** * 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; }
/** * 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; }
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(); }
/** * 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)); } }
/** * 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; }
/** * 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; }
this.currentTag.setName(uri);
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; }
tag.setName(cri.getURITemplate().getValue().replaceAll("/", "_")); if (javadocProvider != null) { tag.setDescription(javadocProvider.getClassDoc(cri));
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); 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);
if (!tagConfig.name().isEmpty()) { Tag tag = new Tag(); tag.setName(tagConfig.name()); tag.setDescription(tagConfig.description());
if (!tagConfig.name().isEmpty()) { Tag tag = new Tag(); tag.setName(tagConfig.name()); tag.setDescription(tagConfig.description());
if (!tagConfig.name().isEmpty()) { Tag tag = new Tag(); tag.setName(tagConfig.name()); tag.setDescription(tagConfig.description());
if (StringUtils.isNotBlank(tagConfig.name())) { final Tag tag = new Tag(); tag.setName(tagConfig.name()); tag.setDescription(tagConfig.description());
if (!tagConfig.name().isEmpty()) { Tag tag = new Tag(); tag.setName(tagConfig.name()); tag.setDescription(tagConfig.description());
if (!tagConfig.name().isEmpty()) { Tag tag = new Tag(); tag.setName(tagConfig.name()); tag.setDescription(tagConfig.description());