@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; }
/** * 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."); } }
private void walkInfo(Info info) { // info object itself has already been visited Contact contact = info.getContact(); if (contact != null) { callbacks.contact(contact); callbacks.any(contact); } License license = info.getLicense(); if (license != null) { callbacks.license(license); callbacks.any(license); } }
@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; }
License license = info.getLicense(); if (license == null) { license = new License();
License license = info.getLicense(); if (license == null) { license = new License();
License license = info.getLicense(); if (license == null) { license = new License();
License license = info.getLicense(); if (license == null) { license = new License();
License license = info.getLicense(); if (license == null) { license = new License();
public Info convert(io.swagger.models.Info v2Info) { Info info = new Info(); info.setContact(convert(v2Info.getContact())); info.setDescription(v2Info.getDescription()); info.setLicense(convert(v2Info.getLicense())); info.setTermsOfService(v2Info.getTermsOfService()); info.setTitle(v2Info.getTitle()); info.setVersion(v2Info.getVersion()); info.setExtensions(convert(v2Info.getVendorExtensions())); return info; }
public Info convert(io.swagger.models.Info v2Info) { Info info = new Info(); info.setContact(convert(v2Info.getContact())); info.setDescription(v2Info.getDescription()); info.setLicense(convert(v2Info.getLicense())); info.setTermsOfService(v2Info.getTermsOfService()); info.setTitle(v2Info.getTitle()); info.setVersion(v2Info.getVersion()); info.setExtensions(convert(v2Info.getVendorExtensions())); return info; }
License license = info.getLicense(); if (license == null) { license = new License();
public Info convert(io.swagger.models.Info v2Info) { Info info = new Info(); info.setContact(convert(v2Info.getContact())); info.setDescription(v2Info.getDescription()); info.setLicense(convert(v2Info.getLicense())); info.setTermsOfService(v2Info.getTermsOfService()); info.setTitle(v2Info.getTitle()); info.setVersion(v2Info.getVersion()); info.setExtensions(convert(v2Info.getVendorExtensions())); return info; }
}); getConfigurationProperty(configurationProperties.getLicenseName()).ifPresent(v -> { if (info.getLicense() == null) { info.setLicense(new License()); info.getLicense().setName(v); }); getConfigurationProperty(configurationProperties.getLicenseUrl()).ifPresent(v -> { if (info.getLicense() == null) { info.setLicense(new License()); info.getLicense().setUrl(v); }); getConfigurationProperty(configurationProperties.getContactName()).ifPresent(v -> { if (info.getLicense() == null) { getConfigurationProperty(parent.getLicenseName()).ifPresent(v -> { if (info.getLicense() == null) { info.setLicense(new License()); info.getLicense().setName(v); }); getConfigurationProperty(parent.getLicenseUrl()).ifPresent(v -> { if (info.getLicense() == null) { info.setLicense(new License()); info.getLicense().setUrl(v); });
License _license = null; if (_info!=null) { _license=_info.getLicense();