@Override public MarkupDocBuilder apply(MarkupDocBuilder markupDocBuilder, Parameters params) { Info info = params.info; License license = info.getLicense(); String termOfService = info.getTermsOfService(); if ((license != null && (isNotBlank(license.getName()) || isNotBlank(license.getUrl()))) || isNotBlank(termOfService)) { markupDocBuilder.sectionTitleLevel(params.titleLevel, labels.getLabel(LICENSE_INFORMATION)); MarkupDocBuilder paragraph = copyMarkupDocBuilder(markupDocBuilder); if (license != null) { if (isNotBlank(license.getName())) { paragraph.italicText(labels.getLabel(LICENSE)).textLine(COLON + license.getName()); } if (isNotBlank(license.getUrl())) { paragraph.italicText(labels.getLabel(LICENSE_URL)).textLine(COLON + license.getUrl()); } } paragraph.italicText(labels.getLabel(TERMS_OF_SERVICE)).textLine(COLON + termOfService); markupDocBuilder.paragraph(paragraph.toString(), true); } return markupDocBuilder; }
private License from(io.swagger.annotations.License licenseAnnotation) { License license = new License() .name(emptyToNull(licenseAnnotation.name())) .url(emptyToNull(licenseAnnotation.url())); if (license.getName() == null && license.getUrl() == null) { license = null; } return license; }
/** * validate configuration according to swagger spec and plugin requirement * * @param apiSource * @throws GenerateException */ private void validateConfiguration(ApiSource apiSource) throws GenerateException { if (apiSource == null) { throw new GenerateException("You do not configure any apiSource!"); } else if (apiSource.getInfo() == null) { throw new GenerateException("`<info>` is required by Swagger Spec."); } if (apiSource.getInfo().getTitle() == null) { throw new GenerateException("`<info><title>` is required by Swagger Spec."); } if (apiSource.getInfo().getVersion() == null) { throw new GenerateException("`<info><version>` is required by Swagger Spec."); } if (apiSource.getInfo().getLicense() != null && apiSource.getInfo().getLicense().getName() == null) { throw new GenerateException("`<info><license><name>` is required by Swagger Spec."); } if (apiSource.getLocations() == null) { throw new GenerateException("<locations> is required by this plugin."); } }
@Override public MarkupDocBuilder apply(MarkupDocBuilder markupDocBuilder, Parameters params) { Info info = params.info; License license = info.getLicense(); String termOfService = info.getTermsOfService(); if ((license != null && (isNotBlank(license.getName()) || isNotBlank(license.getUrl()))) || isNotBlank(termOfService)) { markupDocBuilder.sectionTitleLevel(params.titleLevel, labels.getLabel(LICENSE_INFORMATION)); MarkupDocBuilder paragraph = copyMarkupDocBuilder(markupDocBuilder); if (license != null) { if (isNotBlank(license.getName())) { paragraph.italicText(labels.getLabel(LICENSE)).textLine(COLON + license.getName()); } if (isNotBlank(license.getUrl())) { paragraph.italicText(labels.getLabel(LICENSE_URL)).textLine(COLON + license.getUrl()); } } paragraph.italicText(labels.getLabel(TERMS_OF_SERVICE)).textLine(COLON + termOfService); markupDocBuilder.paragraph(paragraph.toString(), true); } return markupDocBuilder; }
private License convert(io.swagger.models.License v2License) { if (v2License == null) { return null; } License license = new License(); license.setExtensions(convert(v2License.getVendorExtensions())); license.setName(v2License.getName()); license.setUrl(v2License.getUrl()); return license; }
private License convert(io.swagger.models.License v2License) { if (v2License == null) { return null; } License license = new License(); license.setExtensions(convert(v2License.getVendorExtensions())); license.setName(v2License.getName()); license.setUrl(v2License.getUrl()); return license; }
private License convert(io.swagger.models.License v2License) { if (v2License == null) { return null; } License license = new License(); license.setExtensions(convert(v2License.getVendorExtensions())); license.setName(v2License.getName()); license.setUrl(v2License.getUrl()); return license; }
license.setName(settings.getString("swagger.info.license.name", null)); license.setUrl(settings.getString("swagger.info.license.url", null)); if (Strings.isNullOrEmpty(license.getName()) && Strings.isNullOrEmpty(license.getUrl())) {
license.setName(settings.getString("swagger.info.license.name", null)); license.setUrl(settings.getString("swagger.info.license.url", null)); if (Strings.isNullOrEmpty(license.getName()) && Strings.isNullOrEmpty(license.getUrl())) {
String _name = license.getName(); if (_name != null) { _elvis = _name;