public String[] getLicenseNames() { checkInit("getLicenseNames"); List<String> result = new ArrayList<String>(licenses.size()); for (License license : this) { result.add(license.getName()); } return result.toArray(new String[result.size()]); }
@Test(expectedExceptions = LicenseRejectedException.class) public void shouldThrowExceptionOnRejection() { // Given License license = new License("...", "..."); // When license.reject(); // Then this should never be reached }
@Test public void shouldRecordAcceptance() { // Given License license = new License("...", "..."); // When license.accept(); // Then assertTrue(license.isAccepted()); }
@Test public void shouldNotBeAcceptedByDefault() { // Given License license = new License("...", "..."); // When boolean result = license.isAccepted(); // Then assertFalse(result); }
@Test public void shouldGetLicenseFilename() { // Given String licenseFilename = "filename"; License license = new License(licenseFilename, "..."); // When String filename = license.getFilename(); // Then assertEquals(filename, licenseFilename); }
/** * Adds information about references licenses. * * @param pomDescriptor The descriptor for the current POM. * @param model The Maven Model. * @param store The database. */ private void addLicenses(MavenPomDescriptor pomDescriptor, Model model, Store store) { List<License> licenses = model.getLicenses(); for (License license : licenses) { MavenLicenseDescriptor licenseDescriptor = store.create(MavenLicenseDescriptor.class); licenseDescriptor.setUrl(license.getUrl()); licenseDescriptor.setComments(license.getComments()); licenseDescriptor.setName(license.getName()); licenseDescriptor.setDistribution(license.getDistribution()); pomDescriptor.getLicenses().add(licenseDescriptor); } }
@Test public void shouldReturnCorrectLicenseText() { // Given String filename = "..."; String licenseText = "Some license text"; License license = new License(filename, licenseText); // When String result = license.getLicenseText(); // Then assertEquals(result, licenseText); }
@Test(expectedExceptions = LicenseRejectedException.class) public void shouldIncludeRejectedLicenseInException() throws Exception { // Given License license = new License("...", "..."); // When try { license.reject(); } catch (LicenseRejectedException ex) { // Then assertEquals(ex.getRejectedLicense(), license); throw ex; } }
@Test public void testGetUnknownLicense() throws Exception { final DbLicense dbLicense = new DbLicense(); dbLicense.setName("name"); dbLicense.setLongName(""); dbLicense.setComments(""); dbLicense.setRegexp(""); dbLicense.setUrl(""); final ModelMapper modelMapper = new ModelMapper(mock(RepositoryHandler.class)); final License license = modelMapper.getLicense(dbLicense); assertEquals(true, license.isUnknown()); }
@Test public void shouldRecordRejection() { // Given License license = new License("...", "..."); license.accept(); // When try { license.reject(); } catch (LicenseRejectedException ignored) { } // Then: last action should win assertFalse(license.isAccepted()); }
@Test public void shouldReturnCorrectLines() { // Given String licenseText = "line1\nline2\nline3\n"; License license = new License("...", licenseText); // When Iterable<String> lines = license.lines(); StringBuilder sb = new StringBuilder(); for (String line : lines) { sb.append(line).append('\n'); } // Then assertEquals(sb.toString(), licenseText); }
protected URL getFileURL(License license, String filename) throws IOException { URL licenseBaseURL = license.getBaseURL(); URL result = MojoHelper.getUrl(licenseBaseURL, filename); if (!checkExists(result)) { // let's try with a .ftl suffix URL resultWithFtlSuffix = MojoHelper.getUrl(licenseBaseURL, filename + License.TEMPLATE_SUFFIX); if (checkExists(resultWithFtlSuffix)) { result = resultWithFtlSuffix; } else { throw new IllegalArgumentException( "Could not find license (" + license + ") content file at [" + result + "], nor at [" + resultWithFtlSuffix + "] for resolver " + this); } } return result; }
public License getLicense(String licenseName) { checkInit("getLicense"); if (StringUtils.isEmpty(licenseName)) { throw new IllegalArgumentException("licenceName can not be null, nor empty"); } License license = null; for (License l : this) { if (licenseName.equals(l.getName())) { // got it license = l; break; } } return license; }
private void generateDocs(DOMFace rootEle) throws Exception { DOMFace allDocs = rootEle.createChild("documents", DOMFace.class); for (AttachmentRecord att : ngp.getAllAttachments()) { // first check if this license has access if (att.getVisibility() == 1) { // public document, so everyone can get it } else if (isMember) { // members can access everything } else if (att.roleCanAccess(license.getRole())) { // license role has access } else { // no access, so skip to next attachment continue; } DOMFace oneDoc = allDocs.createChild("doc", DOMFace.class); oneDoc.setAttribute("id", att.getId()); oneDoc.setScalar("universalid", att.getUniversalId()); oneDoc.setScalar("name", att.getNiceName()); oneDoc.setScalar("size", Long.toString(att.getFileSize(ngp))); setScalarTime(oneDoc, "modifiedtime", att.getModifiedDate()); oneDoc.setScalar("modifieduser", att.getModifiedBy()); } }
private void generateResponse() throws Exception { String lic = ar.reqParam("lic"); license = ngp.getLicense(lic); if (license == null) { throw new Exception("Can not access this page, license id is no longer valid: " + lic); } String lRole = license.getRole(); if (lRole.equals(ngp.getPrimaryRole().getName())) { isMember = true; } if (lRole.equals(ngp.getSecondaryRole().getName())) { isMember = true; isAdmin = true; } Document mainDoc = DOMUtils.createDocument("case"); DOMFace rootEle = new DOMFace(mainDoc, mainDoc.getDocumentElement(), null); generateDocs(rootEle); generateNotes(rootEle); generateGoals(rootEle); DOMUtils.writeDom(mainDoc, ar.w); }
private static Set<DistributionType> deserializeDistribs(List<String> distributions) throws PackageDeserializationException { try { return License.parseDistributions(distributions); } catch (LicenseParsingException e) { throw new PackageDeserializationException(e); } }
public synchronized boolean equals(java.lang.Object obj) { if (!(obj instanceof License)) return false; License other = (License) obj; if (obj == null) return false; if (this == obj) return true; if (__equalsCalc != null) { return (__equalsCalc == obj); } __equalsCalc = obj; boolean _equals; _equals = true && ((this.p == null && other.getP() == null) || (this.p != null && java.util.Arrays.equals(this.p, other.getP()))) && ((this.licenseType == null && other.getLicenseType() == null) || (this.licenseType != null && this.licenseType.equals(other.getLicenseType()))); __equalsCalc = null; return _equals; }
private static License deserializeLicense(Build.License licensePb) throws PackageDeserializationException { List<String> licenseStrings = new ArrayList<>(); licenseStrings.addAll(licensePb.getLicenseTypeList()); for (String exception : licensePb.getExceptionList()) { licenseStrings.add("exception=" + exception); } try { return License.parseLicense(licenseStrings); } catch (LicenseParsingException e) { throw new PackageDeserializationException(e); } }
@Test public void testGetDbLicense() throws Exception { final License license = DataModelFactory.createLicense("name", "longName", "comments", "regexp", "url"); final ModelMapper modelMapper = new ModelMapper(mock(RepositoryHandler.class)); final DbLicense dbLicense = modelMapper.getDbLicense(license); assertEquals(license.getName(), dbLicense.getName()); assertEquals(license.getLongName(), dbLicense.getLongName()); assertEquals(license.getComments(), dbLicense.getComments()); assertEquals(license.getRegexp(), dbLicense.getRegexp()); assertEquals(license.getUrl(), dbLicense.getUrl()); }
@Test public void testGetLicense() throws Exception { final DbLicense dbLicense = new DbLicense(); dbLicense.setName("name"); dbLicense.setLongName("long name"); dbLicense.setComments("comment"); dbLicense.setRegexp("regexp"); dbLicense.setUrl("url"); final ModelMapper modelMapper = new ModelMapper(mock(RepositoryHandler.class)); final License license = modelMapper.getLicense(dbLicense); assertEquals(dbLicense.getName(), license.getName()); assertEquals(dbLicense.getLongName(), license.getLongName()); assertEquals(dbLicense.getComments(), license.getComments()); assertEquals(dbLicense.getRegexp(), license.getRegexp()); assertEquals(dbLicense.getUrl(), license.getUrl()); }
public void load() throws IOException { checkNotInit("load"); try { if (baseURL == null || StringUtils.isEmpty(baseURL.toString())) { throw new IllegalStateException("no baseURL defined in " + this); } URL definitionURL = MojoHelper.getUrl(getBaseURL(), REPOSITORY_DEFINITION_FILE); if (licenses != null) { licenses.clear(); } else { licenses = new ArrayList<License>(); } if (!checkExists(definitionURL)) { throw new IllegalArgumentException( "no licenses.properties found with url [" + definitionURL + "] for resolver " + this); } Properties p = new Properties(); p.load(definitionURL.openStream()); for (Entry<Object, Object> entry : p.entrySet()) { String licenseName = (String) entry.getKey(); licenseName = licenseName.trim().toLowerCase(); URL licenseBaseURL = MojoHelper.getUrl(baseURL, licenseName); License license = new License(); license.setName(licenseName); license.setBaseURL(licenseBaseURL); String licenseDescription = (String) entry.getValue(); Matcher matcher = LICENSE_DESCRIPTION_PATTERN.matcher(licenseDescription); String licenseFile; String headerFile; if (matcher.matches()) { licenseDescription = matcher.group(1).trim(); licenseFile = matcher.group(2).trim(); headerFile = matcher.group(3).trim(); } else { licenseFile = License.LICENSE_CONTENT_FILE; headerFile = License.LICENSE_HEADER_FILE; } URL licenseFileURL = getFileURL(license, licenseFile); license.setLicenseURL(licenseFileURL); URL headerFileURL = getFileURL(license, headerFile); license.setHeaderURL(headerFileURL); license.setDescription(licenseDescription); if (LOG.isInfoEnabled()) { LOG.info("register " + license.getDescription()); } if (LOG.isDebugEnabled()) { LOG.debug(license); } licenses.add(license); } licenses = Collections.unmodifiableList(licenses); } finally { // mark repository as available init = true; } }
@Override public List<File> generate() { Boolean generateApis = null; Boolean generateModels = null; Boolean generateSupportingFiles = null; Set<String> modelsToGenerate = null; Set<String> apisToGenerate = null; Set<String> supportingFilesToGenerate = null; // allows generating only models by specifying a CSV of models to generate, or empty for all if (System.getProperty("models") != null) { String modelNames = System.getProperty("models"); generateModels = true; if (!modelNames.isEmpty()) { modelsToGenerate = new HashSet<String>(Arrays.asList(modelNames.split(","))); } } if (System.getProperty("apis") != null) { String apiNames = System.getProperty("apis"); generateApis = true; if (!apiNames.isEmpty()) { apisToGenerate = new HashSet<String>(Arrays.asList(apiNames.split(","))); } } if (System.getProperty("supportingFiles") != null) { String supportingFiles = System.getProperty("supportingFiles"); generateSupportingFiles = true; if (!supportingFiles.isEmpty()) { supportingFilesToGenerate = new HashSet<String>(Arrays.asList(supportingFiles.split(","))); } } if (generateApis == null && generateModels == null && generateSupportingFiles == null) { // no specifics are set, generate everything generateApis = true; generateModels = true; generateSupportingFiles = true; } else { if (generateApis == null) { generateApis = false; } if (generateModels == null) { generateModels = false; } if (generateSupportingFiles == null) { generateSupportingFiles = false; } } if (swagger == null || config == null) { throw new RuntimeException("missing swagger input or config!"); } if (System.getProperty("debugSwagger") != null) { Json.prettyPrint(swagger); } List<File> files = new ArrayList<File>(); config.processOpts(); config.preprocessSwagger(swagger); config.additionalProperties().put("generatedDate", DateTime.now().toString()); config.additionalProperties().put("generatorClass", config.getClass().toString()); if (swagger.getInfo() != null) { Info info = swagger.getInfo(); if (info.getTitle() != null) { config.additionalProperties().put("appName", info.getTitle()); } if (info.getVersion() != null) { config.additionalProperties().put("appVersion", info.getVersion()); } if (info.getDescription() != null) { config .additionalProperties() .put("appDescription", config.escapeText(info.getDescription())); } if (info.getContact() != null) { Contact contact = info.getContact(); config.additionalProperties().put("infoUrl", contact.getUrl()); if (contact.getEmail() != null) { config.additionalProperties().put("infoEmail", contact.getEmail()); } } if (info.getLicense() != null) { License license = info.getLicense(); if (license.getName() != null) { config.additionalProperties().put("licenseInfo", license.getName()); } if (license.getUrl() != null) { config.additionalProperties().put("licenseUrl", license.getUrl()); } } if (info.getVersion() != null) { config.additionalProperties().put("version", info.getVersion()); } } StringBuilder hostBuilder = new StringBuilder(); String scheme; if (swagger.getSchemes() != null && swagger.getSchemes().size() > 0) { scheme = swagger.getSchemes().get(0).toValue(); } else { scheme = "https"; } hostBuilder.append(scheme); hostBuilder.append("://"); if (swagger.getHost() != null) { hostBuilder.append(swagger.getHost()); } else { hostBuilder.append("localhost"); } if (swagger.getBasePath() != null) { hostBuilder.append(swagger.getBasePath()); } String contextPath = swagger.getBasePath() == null ? "" : swagger.getBasePath(); String basePath = hostBuilder.toString(); String basePathWithoutHost = swagger.getBasePath(); // resolve inline models InlineModelResolver inlineModelResolver = new InlineModelResolver(); inlineModelResolver.flatten(swagger); List<Object> allOperations = new ArrayList<Object>(); List<Object> allModels = new ArrayList<Object>(); // models Map<String, Model> definitions = swagger.getDefinitions(); if (definitions != null) { List<String> sortedModelKeys = sortModelsByInheritance(definitions); if (generateModels) { if (modelsToGenerate != null && modelsToGenerate.size() > 0) { List<String> updatedKeys = new ArrayList<String>(); for (String m : sortedModelKeys) { if (modelsToGenerate.contains(m)) { updatedKeys.add(m); } } sortedModelKeys = updatedKeys; } for (String name : sortedModelKeys) { try { // don't generate models that have an import mapping if (config.importMapping().containsKey(name)) { continue; } Model model = definitions.get(name); Map<String, Model> modelMap = new HashMap<String, Model>(); modelMap.put(name, model); Map<String, Object> models = processModels(config, modelMap, definitions); models.putAll(config.additionalProperties()); allModels.add(((List<Object>) models.get("models")).get(0)); for (String templateName : config.modelTemplateFiles().keySet()) { String suffix = config.modelTemplateFiles().get(templateName); String filename = config.modelFileFolder() + File.separator + config.toModelFilename(name) + suffix; if (!config.shouldOverwrite(filename)) { continue; } String templateFile = getFullTemplateFile(config, templateName); String template = readTemplate(templateFile); Template tmpl = Mustache.compiler() .withLoader( new Mustache.TemplateLoader() { @Override public Reader getTemplate(String name) { return getTemplateReader( getFullTemplateFile(config, name + ".mustache")); } }) .defaultValue("") .compile(template); writeToFile(filename, tmpl.execute(models)); files.add(new File(filename)); } // to generate model test files for (String templateName : config.modelTestTemplateFiles().keySet()) { String suffix = config.modelTestTemplateFiles().get(templateName); String filename = config.modelTestFileFolder() + File.separator + config.toModelTestFilename(name) + suffix; if (!config.shouldOverwrite(filename)) { continue; } String templateFile = getFullTemplateFile(config, templateName); String template = readTemplate(templateFile); Template tmpl = Mustache.compiler() .withLoader( new Mustache.TemplateLoader() { @Override public Reader getTemplate(String name) { return getTemplateReader( getFullTemplateFile(config, name + ".mustache")); } }) .defaultValue("") .compile(template); writeToFile(filename, tmpl.execute(models)); files.add(new File(filename)); } } catch (Exception e) { throw new RuntimeException("Could not generate model '" + name + "'", e); } } } } if (System.getProperty("debugModels") != null) { LOGGER.info("############ Model info ############"); Json.prettyPrint(allModels); } // apis Map<String, List<CodegenOperation>> paths = processPaths(swagger.getPaths()); if (generateApis) { if (apisToGenerate != null && apisToGenerate.size() > 0) { Map<String, List<CodegenOperation>> updatedPaths = new TreeMap<String, List<CodegenOperation>>(); for (String m : paths.keySet()) { if (apisToGenerate.contains(m)) { updatedPaths.put(m, paths.get(m)); } } paths = updatedPaths; } for (String tag : paths.keySet()) { try { List<CodegenOperation> ops = paths.get(tag); Map<String, Object> operation = processOperations(config, tag, ops); operation.put("basePath", basePath); operation.put("basePathWithoutHost", basePathWithoutHost); operation.put("contextPath", contextPath); operation.put("baseName", tag); operation.put("modelPackage", config.modelPackage()); operation.putAll(config.additionalProperties()); operation.put("classname", config.toApiName(tag)); operation.put("classVarName", config.toApiVarName(tag)); operation.put("importPath", config.toApiImport(tag)); // Pass sortParamsByRequiredFlag through to the Mustache template... boolean sortParamsByRequiredFlag = true; if (this.config .additionalProperties() .containsKey(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG)) { sortParamsByRequiredFlag = Boolean.valueOf( (String) this.config .additionalProperties() .get(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG) .toString()); } operation.put("sortParamsByRequiredFlag", sortParamsByRequiredFlag); processMimeTypes(swagger.getConsumes(), operation, "consumes"); processMimeTypes(swagger.getProduces(), operation, "produces"); allOperations.add(new HashMap<String, Object>(operation)); for (int i = 0; i < allOperations.size(); i++) { Map<String, Object> oo = (Map<String, Object>) allOperations.get(i); if (i < (allOperations.size() - 1)) { oo.put("hasMore", "true"); } } for (String templateName : config.apiTemplateFiles().keySet()) { String filename = config.apiFilename(templateName, tag); if (!config.shouldOverwrite(filename) && new File(filename).exists()) { continue; } String templateFile = getFullTemplateFile(config, templateName); String template = readTemplate(templateFile); Template tmpl = Mustache.compiler() .withLoader( new Mustache.TemplateLoader() { @Override public Reader getTemplate(String name) { return getTemplateReader( getFullTemplateFile(config, name + ".mustache")); } }) .defaultValue("") .compile(template); writeToFile(filename, tmpl.execute(operation)); files.add(new File(filename)); } // to generate api test files for (String templateName : config.apiTestTemplateFiles().keySet()) { String filename = config.apiTestFilename(templateName, tag); if (!config.shouldOverwrite(filename) && new File(filename).exists()) { continue; } String templateFile = getFullTemplateFile(config, templateName); String template = readTemplate(templateFile); Template tmpl = Mustache.compiler() .withLoader( new Mustache.TemplateLoader() { @Override public Reader getTemplate(String name) { return getTemplateReader( getFullTemplateFile(config, name + ".mustache")); } }) .defaultValue("") .compile(template); writeToFile(filename, tmpl.execute(operation)); files.add(new File(filename)); } } catch (Exception e) { throw new RuntimeException("Could not generate api file for '" + tag + "'", e); } } } if (System.getProperty("debugOperations") != null) { LOGGER.info("############ Operation info ############"); Json.prettyPrint(allOperations); } // supporting files Map<String, Object> bundle = new HashMap<String, Object>(); bundle.putAll(config.additionalProperties()); bundle.put("apiPackage", config.apiPackage()); Map<String, Object> apis = new HashMap<String, Object>(); apis.put("apis", allOperations); if (swagger.getHost() != null) { bundle.put("host", swagger.getHost()); } bundle.put("swagger", this.swagger); bundle.put("basePath", basePath); bundle.put("scheme", scheme); bundle.put("contextPath", contextPath); bundle.put("apiInfo", apis); bundle.put("models", allModels); bundle.put("apiFolder", config.apiPackage().replace('.', File.separatorChar)); bundle.put("modelPackage", config.modelPackage()); List<CodegenSecurity> authMethods = config.fromSecurity(swagger.getSecurityDefinitions()); if (authMethods != null && !authMethods.isEmpty()) { bundle.put("authMethods", authMethods); bundle.put("hasAuthMethods", true); } if (swagger.getExternalDocs() != null) { bundle.put("externalDocs", swagger.getExternalDocs()); } for (int i = 0; i < allModels.size() - 1; i++) { HashMap<String, CodegenModel> cm = (HashMap<String, CodegenModel>) allModels.get(i); CodegenModel m = cm.get("model"); m.hasMoreModels = true; } config.postProcessSupportingFileData(bundle); if (System.getProperty("debugSupportingFiles") != null) { LOGGER.info("############ Supporting file info ############"); Json.prettyPrint(bundle); } if (generateSupportingFiles) { for (SupportingFile support : config.supportingFiles()) { try { String outputFolder = config.outputFolder(); if (isNotEmpty(support.folder)) { outputFolder += File.separator + support.folder; } File of = new File(outputFolder); if (!of.isDirectory()) { of.mkdirs(); } String outputFilename = outputFolder + File.separator + support.destinationFilename; if (!config.shouldOverwrite(outputFilename)) { continue; } String templateFile = getFullTemplateFile(config, support.templateFile); boolean shouldGenerate = true; if (supportingFilesToGenerate != null && supportingFilesToGenerate.size() > 0) { if (supportingFilesToGenerate.contains(support.destinationFilename)) { shouldGenerate = true; } else { shouldGenerate = false; } } if (shouldGenerate) { if (templateFile.endsWith("mustache")) { String template = readTemplate(templateFile); Template tmpl = Mustache.compiler() .withLoader( new Mustache.TemplateLoader() { @Override public Reader getTemplate(String name) { return getTemplateReader( getFullTemplateFile(config, name + ".mustache")); } }) .defaultValue("") .compile(template); writeToFile(outputFilename, tmpl.execute(bundle)); files.add(new File(outputFilename)); } else { InputStream in = null; try { in = new FileInputStream(templateFile); } catch (Exception e) { // continue } if (in == null) { in = this.getClass() .getClassLoader() .getResourceAsStream(getCPResourcePath(templateFile)); } File outputFile = new File(outputFilename); OutputStream out = new FileOutputStream(outputFile, false); if (in != null) { LOGGER.info("writing file " + outputFile); IOUtils.copy(in, out); } else { if (in == null) { LOGGER.error("can't open " + templateFile + " for input"); } } files.add(outputFile); } } } catch (Exception e) { throw new RuntimeException("Could not generate supporting file '" + support + "'", e); } } } config.processSwagger(swagger); return files; }
/** Builds the document header of the swagger model */ private void overview() { Info info = swagger.getInfo(); this.markupDocBuilder.documentTitle(info.getTitle()); this.markupDocBuilder.sectionTitleLevel1(OVERVIEW); if (isNotBlank(info.getDescription())) { this.markupDocBuilder.textLine(info.getDescription()); } if (isNotBlank(info.getVersion())) { this.markupDocBuilder.sectionTitleLevel2(CURRENT_VERSION); this.markupDocBuilder.textLine(VERSION + info.getVersion()); } Contact contact = info.getContact(); if (contact != null) { this.markupDocBuilder.sectionTitleLevel2(CONTACT_INFORMATION); if (isNotBlank(contact.getName())) { this.markupDocBuilder.textLine(CONTACT_NAME + contact.getName()); } if (isNotBlank(contact.getEmail())) { this.markupDocBuilder.textLine(CONTACT_EMAIL + contact.getEmail()); } } License license = info.getLicense(); if (license != null && (isNotBlank(license.getName()) || isNotBlank(license.getUrl()))) { this.markupDocBuilder.sectionTitleLevel2(LICENSE_INFORMATION); if (isNotBlank(license.getName())) { this.markupDocBuilder.textLine(LICENSE + license.getName()); } if (isNotBlank(license.getUrl())) { this.markupDocBuilder.textLine(LICENSE_URL + license.getUrl()); } } if (isNotBlank(info.getTermsOfService())) { this.markupDocBuilder.textLine(TERMS_OF_SERVICE + info.getTermsOfService()); } if (isNotBlank(swagger.getHost()) || isNotBlank(swagger.getBasePath()) || isNotEmpty(swagger.getSchemes())) { this.markupDocBuilder.sectionTitleLevel2(URI_SCHEME); if (isNotBlank(swagger.getHost())) { this.markupDocBuilder.textLine(HOST + swagger.getHost()); } if (isNotBlank(swagger.getBasePath())) { this.markupDocBuilder.textLine(BASE_PATH + swagger.getBasePath()); } if (isNotEmpty(swagger.getSchemes())) { List<String> schemes = new ArrayList<>(); for (Scheme scheme : swagger.getSchemes()) { schemes.add(scheme.toString()); } this.markupDocBuilder.textLine(SCHEMES + join(schemes, ", ")); } } if (isNotEmpty(swagger.getTags())) { this.markupDocBuilder.sectionTitleLevel2(TAGS); List<String> tags = new ArrayList<>(); for (Tag tag : swagger.getTags()) { String name = tag.getName(); String description = tag.getDescription(); if (isNoneBlank(description)) { tags.add(name + ": " + description); } else { tags.add(name); } } this.markupDocBuilder.unorderedList(tags); } if (isNotEmpty(swagger.getConsumes())) { this.markupDocBuilder.sectionTitleLevel2(CONSUMES); this.markupDocBuilder.unorderedList(swagger.getConsumes()); } if (isNotEmpty(swagger.getProduces())) { this.markupDocBuilder.sectionTitleLevel2(PRODUCES); this.markupDocBuilder.unorderedList(swagger.getProduces()); } }