private void setInfoFromAnnotation() { Info resultInfo = new Info(); for (Class<?> aClass : getValidClasses(SwaggerDefinition.class)) { SwaggerDefinition swaggerDefinition = AnnotationUtils.findAnnotation(aClass, SwaggerDefinition.class); io.swagger.annotations.Info infoAnnotation = swaggerDefinition.info(); Info info = new Info().title(infoAnnotation.title()) .description(emptyToNull(infoAnnotation.description())) .version(infoAnnotation.version()) .termsOfService(emptyToNull(infoAnnotation.termsOfService())) .license(from(infoAnnotation.license())) .contact(from(infoAnnotation.contact())); Map<String, Object> customExtensions = BaseReaderUtils.parseExtensions(infoAnnotation.extensions()); for (Map.Entry<String, Object> extension : customExtensions.entrySet()) { resultInfo.setVendorExtension(extension.getKey(), extension.getValue()); } resultInfo.mergeWith(info); } info = resultInfo; }
private void convertInfo(io.swagger.annotations.Info infoAnnotation, Swagger swagger) { if (infoAnnotation == null) { return; } Info info = new Info(); info.setTitle(infoAnnotation.title()); info.setVersion(infoAnnotation.version()); info.setDescription(infoAnnotation.description()); info.setTermsOfService(infoAnnotation.termsOfService()); info.setContact(convertContact(infoAnnotation.contact())); info.setLicense(convertLicense(infoAnnotation.license())); info.getVendorExtensions().putAll(BaseReaderUtils.parseExtensions(infoAnnotation.extensions())); swagger.setInfo(info); }
if (!infoConfig.contact().name().isEmpty()) { Contact contact = info.getContact(); if (contact == null) { contact.setName(infoConfig.contact().name()); if (!infoConfig.contact().email().isEmpty()) { contact.setEmail(infoConfig.contact().email()); if (!infoConfig.contact().url().isEmpty()) { contact.setUrl(infoConfig.contact().url());
if (!infoConfig.contact().name().isEmpty()) { Contact contact = info.getContact(); if (contact == null) { contact.setName(infoConfig.contact().name()); if (!infoConfig.contact().email().isEmpty()) { contact.setEmail(infoConfig.contact().email()); if (!infoConfig.contact().url().isEmpty()) { contact.setUrl(infoConfig.contact().url());
if (!infoConfig.contact().name().isEmpty()) { Contact contact = info.getContact(); if (contact == null) { contact.setName(infoConfig.contact().name()); if (!infoConfig.contact().email().isEmpty()) { contact.setEmail(infoConfig.contact().email()); if (!infoConfig.contact().url().isEmpty()) { contact.setUrl(infoConfig.contact().url());
if (!infoConfig.contact().name().isEmpty()) { Contact contact = info.getContact(); if (contact == null) { contact.setName(infoConfig.contact().name()); if (!infoConfig.contact().email().isEmpty()) { contact.setEmail(infoConfig.contact().email()); if (!infoConfig.contact().url().isEmpty()) { contact.setUrl(infoConfig.contact().url());
if (StringUtils.isNotBlank(infoConfig.contact().name())) { Contact contact = info.getContact(); if (contact == null) { contact.setName(infoConfig.contact().name()); if (StringUtils.isNotBlank(infoConfig.contact().email())) { contact.setEmail(infoConfig.contact().email()); if (StringUtils.isNotBlank(infoConfig.contact().url())) { contact.setUrl(infoConfig.contact().url());
if (!infoConfig.contact().name().isEmpty()) { Contact contact = info.getContact(); if (contact == null) { contact.setName(infoConfig.contact().name()); if (!infoConfig.contact().email().isEmpty()) { contact.setEmail(infoConfig.contact().email()); if (!infoConfig.contact().url().isEmpty()) { contact.setUrl(infoConfig.contact().url());
private void convertInfo(io.swagger.annotations.Info infoAnnotation, Swagger swagger) { if (infoAnnotation == null) { return; } Info info = new Info(); info.setTitle(infoAnnotation.title()); info.setVersion(infoAnnotation.version()); info.setDescription(infoAnnotation.description()); info.setTermsOfService(infoAnnotation.termsOfService()); info.setContact(convertContact(infoAnnotation.contact())); info.setLicense(convertLicense(infoAnnotation.license())); info.getVendorExtensions().putAll(BaseReaderUtils.parseExtensions(infoAnnotation.extensions())); swagger.setInfo(info); }