Java Code Examples for io.swagger.v3.oas.models.servers.Server#setDescription()
The following examples show how to use
io.swagger.v3.oas.models.servers.Server#setDescription() .
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: OpenApiObjectGenerator.java From flow with Apache License 2.0 | 6 votes |
private OpenAPI createBasicModel() { OpenAPI openAPI = new OpenAPI(); Info info = new Info(); info.setTitle(configuration.getApplicationTitle()); info.setVersion(configuration.getApplicationApiVersion()); openAPI.setInfo(info); Paths paths = new Paths(); openAPI.setPaths(paths); Server server = new Server(); server.setUrl(configuration.getServerUrl()); server.setDescription(configuration.getServerDescription()); openAPI.setServers(Collections.singletonList(server)); Components components = new Components(); SecurityScheme vaadinConnectOAuth2Scheme = new SecurityScheme() .type(SecurityScheme.Type.OAUTH2) .flows(new OAuthFlows().password(new OAuthFlow() .tokenUrl(VAADIN_CONNECT_OAUTH2_TOKEN_URL) .scopes(new Scopes()))); components.addSecuritySchemes(VAADIN_CONNECT_OAUTH2_SECURITY_SCHEME, vaadinConnectOAuth2Scheme); openAPI.components(components); return openAPI; }
Example 2
Source File: TestOpenAPIFilter.java From RestDoc with Apache License 2.0 | 5 votes |
@Override public OpenAPI handle(OpenAPI openAPI) { System.out.println("handle openapi"); Server server = new Server(); server.setDescription("add by extension"); server.setUrl("http://localhost:8084?info=add_by_extension"); openAPI.getServers().add(server); return openAPI; }
Example 3
Source File: SwaggerServer.java From swagger-maven-plugin with MIT License | 4 votes |
public Server createServerModel() { Server server = new Server(); server.setUrl(url); server.setDescription(description); return server; }
Example 4
Source File: OpenAPIDeserializer.java From swagger-parser with Apache License 2.0 | 4 votes |
public Server getServer(ObjectNode obj, String location, ParseResult result, String path) { if (obj == null) { return null; } Server server = new Server(); String value = getString("url", obj, true, location, result); if(StringUtils.isNotBlank(value)) { if(!isValidURL(value) && path != null){ try { final URI absURI = new URI(path); if("http".equals(absURI.getScheme()) || "https".equals(absURI.getScheme())){ value = absURI.resolve(new URI(value)).toString(); } } catch (URISyntaxException e) { result.warning(location,"invalid url : "+value); } } server.setUrl(value); } value = getString("description", obj, false, location, result); if(StringUtils.isNotBlank(value)) { server.setDescription(value); } if (obj.get("variables") != null) { ObjectNode variables = getObject("variables", obj, false, location, result); ServerVariables serverVariables = getServerVariables(variables, String.format("%s.%s", location, "variables"), result); if (serverVariables != null && serverVariables.size() > 0) { server.setVariables(serverVariables); } } Map <String,Object> extensions = getExtensions(obj); if(extensions != null && extensions.size() > 0) { server.setExtensions(extensions); } Set<String> keys = getKeys(obj); for(String key : keys) { if(!SERVER_KEYS.contains(key) && !key.startsWith("x-")) { result.extra(location, key, obj.get(key)); } } return server; }