Search in sources :

Example 11 with Server

use of org.eclipse.microprofile.openapi.models.servers.Server in project empoa by OpenAPITools.

the class ServerTest method testCreateServer.

@Test
public void testCreateServer() {
    Server server = OASFactory.createServer();
    assertThat(server).isNotNull();
}
Also used : Server(org.eclipse.microprofile.openapi.models.servers.Server) Test(org.junit.jupiter.api.Test)

Example 12 with Server

use of org.eclipse.microprofile.openapi.models.servers.Server in project empoa by OpenAPITools.

the class OASMergeTest method testMergeServer.

@Test
public void testMergeServer() throws Exception {
    Server from1 = OASTestFactory.createTestServer();
    Server into1 = OASFactory.createServer();
    OASMerge.merge(from1, into1);
    asJsonIsEqualTo(from1, into1);
    Server from2 = OASFactory.createServer();
    Server into2 = OASTestFactory.createTestServer();
    OASMerge.merge(from2, into2);
    Server from3 = OASTestFactory.createTestServer();
    Server into3 = OASTestFactory.createTestServer();
    OASMerge.merge(from3, into3);
    asJsonIsEqualTo(from3, into3);
}
Also used : Server(org.eclipse.microprofile.openapi.models.servers.Server) Test(org.junit.jupiter.api.Test)

Example 13 with Server

use of org.eclipse.microprofile.openapi.models.servers.Server in project empoa by OpenAPITools.

the class OASCopy method copy.

public static Server copy(Server from) {
    if (from == null) {
        return null;
    }
    Server to = OASFactory.createServer();
    to.setUrl(from.getUrl());
    to.setDescription(from.getDescription());
    Map<String, ServerVariable> variables = from.getVariables();
    if (variables != null) {
        for (Entry<String, ServerVariable> entry : variables.entrySet()) {
            to.addVariable(entry.getKey(), copy(entry.getValue()));
        }
    }
    Map<String, Object> extensions = from.getExtensions();
    if (extensions != null) {
        for (Entry<String, Object> entry : extensions.entrySet()) {
            to.addExtension(entry.getKey(), entry.getValue());
        }
    }
    return to;
}
Also used : Server(org.eclipse.microprofile.openapi.models.servers.Server) ServerVariable(org.eclipse.microprofile.openapi.models.servers.ServerVariable)

Example 14 with Server

use of org.eclipse.microprofile.openapi.models.servers.Server in project empoa by OpenAPITools.

the class OASCopy method copy.

public static Operation copy(Operation from) {
    if (from == null) {
        return null;
    }
    Operation to = OASFactory.createOperation();
    List<String> tags = from.getTags();
    if (tags != null) {
        for (String item : tags) {
            to.addTag(item);
        }
    }
    to.setSummary(from.getSummary());
    to.setDescription(from.getDescription());
    to.setExternalDocs(copy(from.getExternalDocs()));
    to.setOperationId(from.getOperationId());
    List<Parameter> parameters = from.getParameters();
    if (parameters != null) {
        for (Parameter item : parameters) {
            to.addParameter(copy(item));
        }
    }
    to.setRequestBody(copy(from.getRequestBody()));
    to.setResponses(copy(from.getResponses()));
    Map<String, Callback> callbacks = from.getCallbacks();
    if (callbacks != null) {
        for (Entry<String, Callback> entry : callbacks.entrySet()) {
            to.addCallback(entry.getKey(), copy(entry.getValue()));
        }
    }
    to.setDeprecated(from.getDeprecated());
    List<SecurityRequirement> security = from.getSecurity();
    if (security != null) {
        for (SecurityRequirement item : security) {
            to.addSecurityRequirement(copy(item));
        }
    }
    List<Server> servers = from.getServers();
    if (servers != null) {
        for (Server item : servers) {
            to.addServer(copy(item));
        }
    }
    Map<String, Object> extensions = from.getExtensions();
    if (extensions != null) {
        for (Entry<String, Object> entry : extensions.entrySet()) {
            to.addExtension(entry.getKey(), entry.getValue());
        }
    }
    return to;
}
Also used : Server(org.eclipse.microprofile.openapi.models.servers.Server) Operation(org.eclipse.microprofile.openapi.models.Operation) Callback(org.eclipse.microprofile.openapi.models.callbacks.Callback) Parameter(org.eclipse.microprofile.openapi.models.parameters.Parameter) SecurityRequirement(org.eclipse.microprofile.openapi.models.security.SecurityRequirement)

Example 15 with Server

use of org.eclipse.microprofile.openapi.models.servers.Server in project empoa by OpenAPITools.

the class OASCopy method copy.

public static PathItem copy(PathItem from) {
    if (from == null) {
        return null;
    }
    PathItem to = OASFactory.createPathItem();
    to.setRef(from.getRef());
    to.setSummary(from.getSummary());
    to.setDescription(from.getDescription());
    to.setGET(copy(from.getGET()));
    to.setPUT(copy(from.getPUT()));
    to.setPOST(copy(from.getPOST()));
    to.setDELETE(copy(from.getDELETE()));
    to.setOPTIONS(copy(from.getOPTIONS()));
    to.setHEAD(copy(from.getHEAD()));
    to.setPATCH(copy(from.getPATCH()));
    to.setTRACE(copy(from.getTRACE()));
    List<Server> servers = from.getServers();
    if (servers != null) {
        for (Server item : servers) {
            to.addServer(copy(item));
        }
    }
    List<Parameter> parameters = from.getParameters();
    if (parameters != null) {
        for (Parameter item : parameters) {
            to.addParameter(copy(item));
        }
    }
    Map<String, Object> extensions = from.getExtensions();
    if (extensions != null) {
        for (Entry<String, Object> entry : extensions.entrySet()) {
            to.addExtension(entry.getKey(), entry.getValue());
        }
    }
    return to;
}
Also used : PathItem(org.eclipse.microprofile.openapi.models.PathItem) Server(org.eclipse.microprofile.openapi.models.servers.Server) Parameter(org.eclipse.microprofile.openapi.models.parameters.Parameter)

Aggregations

Server (org.eclipse.microprofile.openapi.models.servers.Server)47 SecurityRequirement (org.eclipse.microprofile.openapi.models.security.SecurityRequirement)11 Parameter (org.eclipse.microprofile.openapi.models.parameters.Parameter)10 OpenAPI (org.eclipse.microprofile.openapi.models.OpenAPI)8 PathItem (org.eclipse.microprofile.openapi.models.PathItem)8 Tag (org.eclipse.microprofile.openapi.models.tags.Tag)8 Callback (org.eclipse.microprofile.openapi.models.callbacks.Callback)7 ServerImpl (io.smallrye.openapi.api.models.servers.ServerImpl)6 List (java.util.List)6 Operation (org.eclipse.microprofile.openapi.models.Operation)6 Info (org.eclipse.microprofile.openapi.models.info.Info)6 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)5 ArrayList (java.util.ArrayList)5 Components (org.eclipse.microprofile.openapi.models.Components)5 SecurityScheme (org.eclipse.microprofile.openapi.models.security.SecurityScheme)5 ServerVariable (org.eclipse.microprofile.openapi.models.servers.ServerVariable)5 Test (org.junit.jupiter.api.Test)5 ServerImpl (fish.payara.microprofile.openapi.impl.model.servers.ServerImpl)4 Map (java.util.Map)4 MediaType (org.eclipse.microprofile.openapi.models.media.MediaType)4