Java Code Examples for io.swagger.v3.oas.models.info.Contact#getEmail()
The following examples show how to use
io.swagger.v3.oas.models.info.Contact#getEmail() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OverviewDocument.java From swagger2markup with Apache License 2.0 | 5 votes |
private void addAuthorInfo(Document rootDocument, Info info) { Contact contact = info.getContact(); if (null != contact) { String author = Optional.ofNullable(contact.getName()).orElse(""); String email = contact.getEmail(); if (StringUtils.isNotBlank(email)) { rootDocument.setAttribute("email", email, true); } rootDocument.setAttribute("author", author, true); rootDocument.setAttribute("authorcount", 1L, true); } }
Example 2
Source File: DefaultGenerator.java From openapi-generator with Apache License 2.0 | 4 votes |
private void configureOpenAPIInfo() { Info info = this.openAPI.getInfo(); if (info == null) { return; } if (info.getTitle() != null) { config.additionalProperties().put("appName", config.escapeText(info.getTitle())); } if (info.getVersion() != null) { config.additionalProperties().put("appVersion", config.escapeText(info.getVersion())); } else { LOGGER.error("Missing required field info version. Default appVersion set to 1.0.0"); config.additionalProperties().put("appVersion", "1.0.0"); } if (StringUtils.isEmpty(info.getDescription())) { // set a default description if none if provided config.additionalProperties().put("appDescription", "No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)"); config.additionalProperties().put("appDescriptionWithNewLines", config.additionalProperties().get("appDescription")); config.additionalProperties().put("unescapedAppDescription", "No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)"); } else { config.additionalProperties().put("appDescription", config.escapeText(info.getDescription())); config.additionalProperties().put("appDescriptionWithNewLines", config.escapeTextWhileAllowingNewLines(info.getDescription())); config.additionalProperties().put("unescapedAppDescription", info.getDescription()); } if (info.getContact() != null) { Contact contact = info.getContact(); if (contact.getEmail() != null) { config.additionalProperties().put("infoEmail", config.escapeText(contact.getEmail())); } if (contact.getName() != null) { config.additionalProperties().put("infoName", config.escapeText(contact.getName())); } if (contact.getUrl() != null) { config.additionalProperties().put("infoUrl", config.escapeText(contact.getUrl())); } } if (info.getLicense() != null) { License license = info.getLicense(); if (license.getName() != null) { config.additionalProperties().put("licenseInfo", config.escapeText(license.getName())); } if (license.getUrl() != null) { config.additionalProperties().put("licenseUrl", config.escapeText(license.getUrl())); } } if (info.getVersion() != null) { config.additionalProperties().put("version", config.escapeText(info.getVersion())); } else { LOGGER.error("Missing required field info version. Default version set to 1.0.0"); config.additionalProperties().put("version", "1.0.0"); } if (info.getTermsOfService() != null) { config.additionalProperties().put("termsOfService", config.escapeText(info.getTermsOfService())); } }