Java Code Examples for io.swagger.models.Swagger#getPaths()

The following examples show how to use io.swagger.models.Swagger#getPaths() . 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: ApiDocV2Service.java    From api-layer with Eclipse Public License 2.0 8 votes vote down vote up
/**
 * Updates BasePath and Paths in Swagger
 *
 * @param swagger    the API doc
 * @param serviceId  the unique service id
 * @param apiDocInfo the service information
 * @param hidden     do not set Paths for automatically generated API doc
 */
protected void updatePaths(Swagger swagger, String serviceId, ApiDocInfo apiDocInfo, boolean hidden) {
    ApiDocPath<Path> apiDocPath = new ApiDocPath<>();
    String basePath = swagger.getBasePath();

    if (swagger.getPaths() != null && !swagger.getPaths().isEmpty()) {
        swagger.getPaths()
            .forEach((originalEndpoint, path)
                -> preparePath(path, apiDocPath, apiDocInfo, basePath, originalEndpoint, serviceId));
    }

    Map<String, Path> updatedPaths;
    if (apiDocPath.getPrefixes().size() == 1) {
        swagger.setBasePath(OpenApiUtil.SEPARATOR + apiDocPath.getPrefixes().iterator().next() + OpenApiUtil.SEPARATOR + serviceId);
        updatedPaths = apiDocPath.getShortPaths();
    } else {
        swagger.setBasePath("");
        updatedPaths = apiDocPath.getLongPaths();
    }

    if (!hidden) {
        swagger.setPaths(updatedPaths);
    }
}
 
Example 2
Source File: PlantUMLCodegen.java    From swagger2puml with Apache License 2.0 6 votes vote down vote up
/**
 * 
 * @param swagger
 * @return
 */
private List<InterfaceDiagram> processSwaggerPaths(Swagger swagger) {
	LOGGER.entering(LOGGER.getName(), "processSwaggerPaths");
	List<InterfaceDiagram> interfaceDiagrams = new ArrayList<InterfaceDiagram>();
	Map<String, Path> paths = swagger.getPaths();

	for (Map.Entry<String, Path> entry : paths.entrySet()) {
		Path pathObject = entry.getValue();

		LOGGER.info("Processing Path --> " + entry.getKey());

		List<Operation> operations = pathObject.getOperations();
		String uri = entry.getKey();

		for (Operation operation : operations) {
			interfaceDiagrams.add(getInterfaceDiagram(operation, uri));
		}
	}

	LOGGER.exiting(LOGGER.getName(), "processSwaggerPaths");
	return interfaceDiagrams;
}
 
Example 3
Source File: SwaggerFilter.java    From SciGraph with Apache License 2.0 6 votes vote down vote up
private byte[] writeDynamicResource(InputStream is) throws IOException {
  String str = CharStreams.toString(new InputStreamReader(is, Charsets.UTF_8));
  Swagger swagger = new SwaggerParser().parse(str);
  // set the resource listing tag
  Tag dynamic = new Tag();
  dynamic.setName("dynamic");
  dynamic.setDescription("Dynamic Cypher resources");
  swagger.addTag(dynamic);
  // add resources to the path
  Map<String,Path> paths = swagger.getPaths();
  paths.putAll(configuration.getCypherResources());
  Map<String,Path> sorted = new LinkedHashMap<>();
  List<String> keys = new ArrayList<>();
  keys.addAll(paths.keySet());
  Collections.sort(keys);
  for (String key : keys) {
    sorted.put(key, paths.get(key));
  }
  swagger.setPaths(sorted);
  // return updated swagger JSON
  return Json.pretty(swagger).getBytes();
}
 
Example 4
Source File: AbstractContractValidator.java    From assertj-swagger with Apache License 2.0 6 votes vote down vote up
/**
 * Finds the expected paths considering both {@code pathsPrependExpected} in the config and {@code basePath} in the Swagger model. The configured value
 * takes precedence regardless of whether it happens to be the same value as the base path or not. If no prefix is configured the Swagger base path is added
 * to each actual path.
 *
 * @param expected        Swagger model
 * @param assertionConfig assertion configuration
 * @return expected paths
 */
protected Map<String, Path> findExpectedPaths(Swagger expected, SwaggerAssertionConfig assertionConfig) {
    String pathsPrependExpected = assertionConfig.getPathsPrependExpected();
    String basePath = expected.getBasePath();
    if (StringUtils.isBlank(pathsPrependExpected) && isBlankOrSlash(basePath)) {
        return expected.getPaths();   // no path prefix configured and no basePath set, nothing to do
    }

    String pathPrefix = null;
    if (StringUtils.isNotBlank(pathsPrependExpected)) {
        pathPrefix = pathsPrependExpected;
    } else if (!isBlankOrSlash(basePath)) {
        pathPrefix = basePath;
    }

    final String finalPathPrefix = pathPrefix;
    return finalPathPrefix == null ?
            expected.getPaths() :
            getPathsWithPrefix(expected, finalPathPrefix);
}
 
Example 5
Source File: FlaskConnexionCodegen.java    From TypeScript-Microservices with MIT License 5 votes vote down vote up
@Override
public void preprocessSwagger(Swagger swagger) {
    // need vendor extensions for x-swagger-router-controller
    Map<String, Path> paths = swagger.getPaths();
    if(paths != null) {
        for(String pathname : paths.keySet()) {
            Path path = paths.get(pathname);
            Map<HttpMethod, Operation> operationMap = path.getOperationMap();
            if(operationMap != null) {
                for(HttpMethod method : operationMap.keySet()) {
                    Operation operation = operationMap.get(method);
                    String tag = "default";
                    if(operation.getTags() != null && operation.getTags().size() > 0) {
                        tag = operation.getTags().get(0);
                    }
                    String operationId = operation.getOperationId();
                    if(operationId == null) {
                        operationId = getOrGenerateOperationId(operation, pathname, method.toString());
                    }
                    operation.setOperationId(toOperationId(operationId));
                    if(operation.getVendorExtensions().get("x-swagger-router-controller") == null) {
                        operation.getVendorExtensions().put(
                                "x-swagger-router-controller",
                                controllerPackage + "." + toApiFilename(tag)
                        );
                    }
                    for (Parameter param: operation.getParameters()) {
                        // sanitize the param name but don't underscore it since it's used for request mapping
                        String name = param.getName();
                        String paramName = sanitizeName(name);
                        if (!paramName.equals(name)) {
                            LOGGER.warn(name + " cannot be used as parameter name with flask-connexion and was sanitized as " + paramName);
                        }
                        param.setName(paramName);
                    }
                }
            }
        }
    }
}
 
Example 6
Source File: ApiGatewaySwaggerFileImporter.java    From aws-apigateway-importer with Apache License 2.0 5 votes vote down vote up
private Swagger parse(String filePath) {
    final Swagger swagger = parser.read(filePath);

    if (swagger != null && swagger.getPaths() != null) {
        LOG.info("Parsed Swagger with " + swagger.getPaths().size() + " paths");
    }

    return swagger;
}
 
Example 7
Source File: SwaggerInventory.java    From swagger-parser with Apache License 2.0 5 votes vote down vote up
public SwaggerInventory process(Swagger swagger) {
    Iterator var2;
    if(swagger.getTags() != null) {
        var2 = swagger.getTags().iterator();

        while(var2.hasNext()) {
            Tag key = (Tag)var2.next();
            this.process(key);
        }
    }

    String key1;
    if(swagger.getPaths() != null) {
        var2 = swagger.getPaths().keySet().iterator();

        while(var2.hasNext()) {
            key1 = (String)var2.next();
            Path model = swagger.getPath(key1);
            this.process(model);
        }
    }

    if(swagger.getDefinitions() != null) {
        var2 = swagger.getDefinitions().keySet().iterator();

        while(var2.hasNext()) {
            key1 = (String)var2.next();
            Model model1 = (Model)swagger.getDefinitions().get(key1);
            this.process(model1);
        }
    }

    return this;
}
 
Example 8
Source File: APIExplorerIntegrationTest.java    From rest-api-explorer with Apache License 2.0 5 votes vote down vote up
private void validateCoreDefn(String coreDefinitionUrl) {
    Swagger swagger = validateSwaggerDef(coreDefinitionUrl, "Alfresco Content Services REST API", "Core API", "1");
    Map<String, Path> paths = swagger.getPaths();
    assertNotNull("Expected to retrieve a map of paths", paths);
    assertTrue("Expected to find /nodes/{nodeId} path", paths.containsKey("/nodes/{nodeId}"));
    assertTrue("Expected to find /nodes/{nodeId}/comments path", paths.containsKey("/nodes/{nodeId}/comments"));
    assertTrue("Expected to find /shared-links path", paths.containsKey("/shared-links"));
}
 
Example 9
Source File: SwaggerUtils.java    From servicecomb-java-chassis with Apache License 2.0 5 votes vote down vote up
public static void correctResponses(Swagger swagger) {
  if (swagger.getPaths() == null) {
    return;
  }

  for (Path path : swagger.getPaths().values()) {
    for (Operation operation : path.getOperations()) {
      correctResponses(operation);
    }
  }
}
 
Example 10
Source File: MySwaggerModelExtension.java    From swagger2markup with Apache License 2.0 5 votes vote down vote up
public void apply(Swagger swagger) {
    swagger.setHost("newHostName"); //<1>
    swagger.basePath("newBasePath");

    Map<String, Path> paths = swagger.getPaths(); //<2>
    paths.remove("/remove");
    swagger.setPaths(paths);
}
 
Example 11
Source File: ReaderTest.java    From swagger-dubbo with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings({  "serial" })
	@Test
	public void testApplyParameters(){
		Swagger swagger = new Swagger();
		Reader.read(swagger, new HashMap<Class<?>, Object>(){{
			put(InterfaceServiceTest.class, new InterfaceServiceImplTest());
		}}, "/h");
		
//		System.out.println(Json.pretty(swagger));
		Map<String, Path> paths = swagger.getPaths();
		Assert.assertEquals(paths.size(), 4);
		
		Path path = swagger.getPaths().get("/h/com.deepoove.swagger.dubbo.api.InterfaceServiceTest/test");
		Assert.assertNotNull(path);
		Operation operation = path.getOperationMap().get(HttpMethod.POST);
		Assert.assertNotNull(operation);
		Assert.assertNotNull(operation.getParameters());
		Assert.assertEquals(operation.getSummary(), "查询用户");
		
		List<Parameter> parameters = operation.getParameters();
		Assert.assertEquals(parameters.get(0).getName(), "para");
		Assert.assertEquals(parameters.get(1).getName(), "code");
		
		Assert.assertTrue(parameters.get(0).getRequired());
		Assert.assertEquals(parameters.get(0).getDescription(), "参数");
		
		
		path = swagger.getPaths().get("/h/com.deepoove.swagger.dubbo.api.InterfaceServiceTest/login/bypwd");
        Assert.assertNotNull(path);
        path = swagger.getPaths().get("/h/com.deepoove.swagger.dubbo.api.InterfaceServiceTest/login");
        Assert.assertNotNull(path);
		
	}
 
Example 12
Source File: AbstractJavaCodegen.java    From TypeScript-Microservices with MIT License 5 votes vote down vote up
@Override
public void preprocessSwagger(Swagger swagger) {
    if (swagger == null || swagger.getPaths() == null){
        return;
    }
    for (String pathname : swagger.getPaths().keySet()) {
        Path path = swagger.getPath(pathname);
        if (path.getOperations() == null){
            continue;
        }
        for (Operation operation : path.getOperations()) {
            boolean hasFormParameters = false;
            boolean hasBodyParameters = false;
            for (Parameter parameter : operation.getParameters()) {
                if (parameter instanceof FormParameter) {
                    hasFormParameters = true;
                }
                if (parameter instanceof BodyParameter) {
                    hasBodyParameters = true;
                }
            }
            if (hasBodyParameters || hasFormParameters){
                String defaultContentType = hasFormParameters ? "application/x-www-form-urlencoded" : "application/json";
                String contentType =  operation.getConsumes() == null || operation.getConsumes().isEmpty() ? defaultContentType : operation.getConsumes().get(0);
                operation.setVendorExtension("x-contentType", contentType);
            }
            String accepts = getAccept(operation);
            operation.setVendorExtension("x-accepts", accepts);
        }
    }
}
 
Example 13
Source File: JavaVertXServerCodegen.java    From TypeScript-Microservices with MIT License 5 votes vote down vote up
@Override
public void preprocessSwagger(Swagger swagger) {
    super.preprocessSwagger(swagger);

    // add full swagger definition in a mustache parameter
    String swaggerDef = Json.pretty(swagger);
    this.additionalProperties.put("fullSwagger", swaggerDef);

    // add server port from the swagger file, 8080 by default
    String host = swagger.getHost();
    String port = extractPortFromHost(host);
    this.additionalProperties.put("serverPort", port);

    // retrieve api version from swagger file, 1.0.0-SNAPSHOT by default
    if (swagger.getInfo() != null && swagger.getInfo().getVersion() != null) {
        artifactVersion = apiVersion = swagger.getInfo().getVersion();
    } else {
        artifactVersion = apiVersion;
    }

    /*
     * manage operation & custom serviceId because operationId field is not
     * required and may be empty
     */
    Map<String, Path> paths = swagger.getPaths();
    if (paths != null) {
        for (Entry<String, Path> entry : paths.entrySet()) {
            manageOperationNames(entry.getValue(), entry.getKey());
        }
    }
    this.additionalProperties.remove("gson");
}
 
Example 14
Source File: AbstractContractValidator.java    From assertj-swagger with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the paths from the actual Swagger model. Each path is prefixed with the base path configured in the model.
 *
 * @param actual Swagger model
 * @return paths including base path
 */
protected Map<String, Path> getPathsIncludingBasePath(Swagger actual) {
    String basePath = actual.getBasePath();
    return isBlankOrSlash(basePath) ?
            actual.getPaths() :
            getPathsWithPrefix(actual, basePath);
}
 
Example 15
Source File: OAS2Parser.java    From carbon-apimgt with Apache License 2.0 4 votes vote down vote up
/**
 * This method returns URI templates according to the given swagger file(Swagger version 2)
 *
 * @param swagger Swagger
 * @return Swagger
 * @throws APIManagementException
 */
private Swagger injectOtherResourceScopesToDefaultScheme(Swagger swagger) throws APIManagementException {
    List<String> schemes = getOtherSchemes();

    Map<String, Path> paths = swagger.getPaths();
    for (String pathKey : paths.keySet()) {
        Path pathItem = paths.get(pathKey);
        Map<HttpMethod, Operation> operationsMap = pathItem.getOperationMap();
        for (Map.Entry<HttpMethod, Operation> entry : operationsMap.entrySet()) {
            HttpMethod httpMethod = entry.getKey();
            Operation operation = entry.getValue();
            Map<String, List<String>> updatedDefaultSecurityRequirement = new HashMap<>();
            List<Map<String, List<String>>> securityRequirements = operation.getSecurity();
            if (securityRequirements == null) {
                securityRequirements = new ArrayList<>();
            }
            if (APIConstants.SUPPORTED_METHODS.contains(httpMethod.name().toLowerCase())) {
                List<String> opScopesDefault = new ArrayList<>();
                List<String> opScopesDefaultInstance = getScopeOfOperations(SWAGGER_SECURITY_SCHEMA_KEY, operation);
                if (opScopesDefaultInstance != null) {
                    opScopesDefault.addAll(opScopesDefaultInstance);
                }
                updatedDefaultSecurityRequirement.put(SWAGGER_SECURITY_SCHEMA_KEY, opScopesDefault);
                for (Map<String, List<String>> input : securityRequirements) {
                    for (String scheme : schemes) {
                        if (!SWAGGER_SECURITY_SCHEMA_KEY.equals(scheme)) {
                            List<String> opScopesOthers = getScopeOfOperations(scheme, operation);
                            if (opScopesOthers != null) {
                                for (String scope : opScopesOthers) {
                                    if (!opScopesDefault.contains(scope)) {
                                        opScopesDefault.add(scope);
                                    }
                                }
                            }
                        }
                        updatedDefaultSecurityRequirement.put(SWAGGER_SECURITY_SCHEMA_KEY, opScopesDefault);
                    }
                }
                securityRequirements.add(updatedDefaultSecurityRequirement);
            }
            operation.setSecurity(securityRequirements);
            entry.setValue(operation);
            operationsMap.put(httpMethod, operation);
        }
        paths.put(pathKey, pathItem);
    }
    swagger.setPaths(paths);
    return swagger;
}
 
Example 16
Source File: ImportController.java    From restfiddle with Apache License 2.0 4 votes vote down vote up
private void swaggerToRFConverter(String projectId, String name, MultipartFile file) throws IOException {
// MultipartFile file
File tempFile = File.createTempFile("RF_SWAGGER_IMPORT", "JSON");
file.transferTo(tempFile);
Swagger swagger = new SwaggerParser().read(tempFile.getAbsolutePath());

String host = swagger.getHost();
String basePath = swagger.getBasePath();

Info info = swagger.getInfo();
String title = info.getTitle();
String description = info.getDescription();

NodeDTO folderNode = createFolder(projectId, title);
folderNode.setDescription(description);

ConversationDTO conversationDTO;

Map<String, Path> paths = swagger.getPaths();
Set<String> keySet = paths.keySet();
for (Iterator<String> iterator = keySet.iterator(); iterator.hasNext();) {
    String pathKey = iterator.next();
    Path path = paths.get(pathKey);

    Map<HttpMethod, Operation> operationMap = path.getOperationMap();
    Set<HttpMethod> operationsKeySet = operationMap.keySet();
    for (Iterator<HttpMethod> operIterator = operationsKeySet.iterator(); operIterator.hasNext();) {
	HttpMethod httpMethod = operIterator.next();
	Operation operation = operationMap.get(httpMethod);

	conversationDTO = new ConversationDTO();
	RfRequestDTO rfRequestDTO = new RfRequestDTO();
	rfRequestDTO.setApiUrl("http://" + host + basePath + pathKey);
	rfRequestDTO.setMethodType(httpMethod.name());
	operation.getParameters();
	conversationDTO.setRfRequestDTO(rfRequestDTO);
	ConversationDTO createdConversation = conversationController.create(conversationDTO);
	conversationDTO.setId(createdConversation.getId());

	String operationId = operation.getOperationId();
	String summary = operation.getSummary();
	// Request Node
	NodeDTO childNode = new NodeDTO();
	childNode.setName(operationId);
	childNode.setDescription(summary);
	childNode.setProjectId(projectId);
	childNode.setConversationDTO(conversationDTO);
	NodeDTO createdChildNode = nodeController.create(folderNode.getId(), childNode);
	System.out.println("created node : " + createdChildNode.getName());
    }
}
   }
 
Example 17
Source File: APIExplorerIntegrationTest.java    From rest-api-explorer with Apache License 2.0 4 votes vote down vote up
private void validateAuthDefn(String definitionUrl) {
    Swagger swagger = validateSwaggerDef(definitionUrl, "Alfresco Content Services REST API", "Authentication API", "1");
    Map<String, Path> paths = swagger.getPaths();
    assertNotNull("Expected to retrieve a map of paths", paths);
    assertTrue("Expected to find /tickets path", paths.containsKey("/tickets"));
}
 
Example 18
Source File: APIExplorerIntegrationTest.java    From rest-api-explorer with Apache License 2.0 4 votes vote down vote up
private void validateWorkflow(String workflowDefinitionUrl) {
    Swagger swagger = validateSwaggerDef(workflowDefinitionUrl, "Alfresco Content Services REST API", "Workflow API", "1");
    Map<String, Path> paths = swagger.getPaths();
    assertNotNull("Expected to retrieve a map of paths", paths);
    assertTrue("Expected to find /deployments/{deploymentId} path", paths.containsKey("/deployments/{deploymentId}"));
}
 
Example 19
Source File: APIExplorerIntegrationTest.java    From rest-api-explorer with Apache License 2.0 4 votes vote down vote up
private void validateSearchDefn(String definitionUrl) {
    Swagger swagger = validateSwaggerDef(definitionUrl, "Alfresco Content Services REST API", "Search API", "1");
    Map<String, Path> paths = swagger.getPaths();
    assertNotNull("Expected to retrieve a map of paths", paths);
    assertTrue("Expected to find /search path", paths.containsKey("/search"));
}
 
Example 20
Source File: SpecificationDiff.java    From swagger-diff with Apache License 2.0 4 votes vote down vote up
public static SpecificationDiff diff(Swagger oldSpec, Swagger newSpec) {
    if (null == oldSpec || null == newSpec) { throw new IllegalArgumentException("cannot diff null spec."); }
    SpecificationDiff instance = new SpecificationDiff();
    Map<String, Path> oldPaths = oldSpec.getPaths();
    Map<String, Path> newPaths = newSpec.getPaths();

    // Diff path
    MapKeyDiff<String, Path> pathDiff = MapKeyDiff.diff(oldPaths, newPaths);
    instance.newEndpoints = convert2EndpointList(pathDiff.getIncreased());
    instance.missingEndpoints = convert2EndpointList(pathDiff.getMissing());
    instance.changedEndpoints = new ArrayList<>();

    List<String> sharedKey = pathDiff.getSharedKey();
    sharedKey.stream().forEach((pathUrl) -> {
        ChangedEndpoint changedEndpoint = new ChangedEndpoint();
        changedEndpoint.setPathUrl(pathUrl);
        Path oldPath = oldPaths.get(pathUrl);
        Path newPath = newPaths.get(pathUrl);

        // Diff Operation
        Map<HttpMethod, Operation> oldOperationMap = oldPath.getOperationMap();
        Map<HttpMethod, Operation> newOperationMap = newPath.getOperationMap();
        MapKeyDiff<HttpMethod, Operation> operationDiff = MapKeyDiff.diff(oldOperationMap, newOperationMap);
        Map<HttpMethod, Operation> increasedOperation = operationDiff.getIncreased();
        Map<HttpMethod, Operation> missingOperation = operationDiff.getMissing();
        changedEndpoint.setNewOperations(increasedOperation);
        changedEndpoint.setMissingOperations(missingOperation);

        List<HttpMethod> sharedMethods = operationDiff.getSharedKey();
        Map<HttpMethod, ChangedOperation> operas = new HashMap<>();
        sharedMethods.stream().forEach((method) -> {
            ChangedOperation changedOperation = new ChangedOperation();
            Operation oldOperation = oldOperationMap.get(method);
            Operation newOperation = newOperationMap.get(method);
            changedOperation.setSummary(newOperation.getSummary());

            // Diff Parameter
            List<Parameter> oldParameters = oldOperation.getParameters();
            List<Parameter> newParameters = newOperation.getParameters();
            ParameterDiff parameterDiff = ParameterDiff
                    .buildWithDefinition(oldSpec.getDefinitions(), newSpec.getDefinitions())
                    .diff(oldParameters, newParameters);
            changedOperation.setAddParameters(parameterDiff.getIncreased());
            changedOperation.setMissingParameters(parameterDiff.getMissing());
            changedOperation.setChangedParameter(parameterDiff.getChanged());

            // Diff response
            Property oldResponseProperty = getResponseProperty(oldOperation);
            Property newResponseProperty = getResponseProperty(newOperation);
            PropertyDiff propertyDiff = PropertyDiff.buildWithDefinition(oldSpec.getDefinitions(),
                    newSpec.getDefinitions());
            propertyDiff.diff(oldResponseProperty, newResponseProperty);
            changedOperation.setAddProps(propertyDiff.getIncreased());
            changedOperation.setMissingProps(propertyDiff.getMissing());
            changedOperation.setChangedProps(propertyDiff.getChanged());

            // Diff Consumes
            ListDiff<String> consumeDiff = getMediaTypeDiff(oldOperation.getConsumes(), newOperation.getConsumes());
            changedOperation.setAddConsumes(consumeDiff.getIncreased());
            changedOperation.setMissingConsumes(consumeDiff.getMissing());

            // Diff Produces
            ListDiff<String> producesDiff = getMediaTypeDiff(oldOperation.getProduces(),
                    newOperation.getProduces());
            changedOperation.setAddProduces(producesDiff.getIncreased());
            changedOperation.setMissingProduces(producesDiff.getMissing());

            if (changedOperation.isDiff()) {
                operas.put(method, changedOperation);
            }
        });
        changedEndpoint.setChangedOperations(operas);

        instance.newEndpoints
                .addAll(convert2EndpointList(changedEndpoint.getPathUrl(), changedEndpoint.getNewOperations()));
        instance.missingEndpoints
                .addAll(convert2EndpointList(changedEndpoint.getPathUrl(), changedEndpoint.getMissingOperations()));

        if (changedEndpoint.isDiff()) {
            instance.changedEndpoints.add(changedEndpoint);
        }
    });

    return instance;

}