private void convertTags(SwaggerDefinition definitionAnnotation, Swagger swagger) { if (definitionAnnotation.tags() == null) { return; } Stream<io.swagger.annotations.Tag> stream = Arrays.asList(definitionAnnotation.tags()).stream(); List<Tag> tags = stream.map(this::convertTag).collect(Collectors.toList()); swagger.setTags(tags); }
public Swagger tags(List<Tag> tags) { this.setTags(tags); return this; }
private void convertTags(SwaggerDefinition definitionAnnotation, Swagger swagger) { if (definitionAnnotation.tags() == null) { return; } Stream<io.swagger.annotations.Tag> stream = Arrays.asList(definitionAnnotation.tags()).stream(); List<Tag> tags = stream.map(this::convertTag).collect(Collectors.toList()); swagger.setTags(tags); }
/** * Add the service's tags to Swagger. * * @param clazz The service class */ private void setTags(Class<?> clazz) { if (this.swagger.getTags() == null) { this.swagger.setTags(new LinkedList<>()); } this.swagger.getTags().addAll(getApiTagsAsList(clazz)); }
/** * 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)); } }
List<String> integrationTags = new ArrayList<>(); swagger.setTags(new ArrayList<>());
combined.setTags(tags);
}); swagger.setTags(swaggerTags);
private Swagger createSwagger(final Set<Class<?>> classes,final URL url){ Swagger swagger = new Reader(new Swagger()).read(classes); Info info = getSwaggerInfo(swagger); if(info!=null)swagger.setInfo(info); Map<String, SecuritySchemeDefinition> securityDefinitions = getSecurityDefinitions(swagger); if(securityDefinitions!=null)swagger.setSecurityDefinitions(securityDefinitions); String consumes = whiteLabel.getProperty(CONSUMES, null); if(anyIsSet(consumes))swagger.setConsumes(toList(swagger.getConsumes(),consumes)); String produces = whiteLabel.getProperty(PRODUCES, null); if(anyIsSet(produces))swagger.setProduces(toList(swagger.getProduces(),produces)); String basePath = whiteLabel.getProperty(BASE_PATH, getBasePath(swagger.getBasePath(), url)); if(anyIsSet(basePath))swagger.setBasePath(basePath); String schemes = whiteLabel.getProperty(SCHEMES, url.getProtocol().toUpperCase()); if(anyIsSet(schemes))swagger.setSchemes(toSchemeList(swagger.getSchemes(),schemes)); String host = whiteLabel.getProperty(HOST, url.getHost() + DOUBLE_POINT + url.getPort()); if(anyIsSet(host))swagger.setHost(host); String tags = whiteLabel.getProperty(TAGS, null); if(anyIsSet(tags))swagger.setTags(toTagList(swagger.getTags(),tags)); return swagger; }
@Override public void swagger(Swagger swagger) { swagger.setSchemes(fillList(swagger.getSchemes())); swagger.setConsumes(fillList(swagger.getConsumes())); swagger.setProduces(fillList(swagger.getProduces())); swagger.setPaths(fillMap(swagger.getPaths())); swagger.setDefinitions(fillMap(swagger.getDefinitions())); swagger.setParameters(fillMap(swagger.getParameters())); swagger.setResponses(fillMap(swagger.getResponses())); swagger.setSecurityDefinitions(fillMap(swagger.getSecurityDefinitions())); swagger.setSecurity(fillList(swagger.getSecurity())); swagger.setTags(fillList(swagger.getTags())); }