Merge branch 'main' of https://gitea.kamma.cz/kamma/apicurio-migration-tool
This commit is contained in:
commit
66b46259b2
@ -22,6 +22,8 @@ import cz.trask.migration.util.CredentialsDecoder;
|
||||
|
||||
public class ApiDefinitionMapper32to45 {
|
||||
|
||||
private static final String CONTEXT_VERSION_TEMPLATE = "/{version}";
|
||||
|
||||
public static ApiDefinition45 map(ApiDefinition32 oldApi, String swagger) throws Exception {
|
||||
if (oldApi == null)
|
||||
return null;
|
||||
@ -46,7 +48,7 @@ public class ApiDefinitionMapper32to45 {
|
||||
data.setProvider(oldApi.getId() != null ? oldApi.getId().getProviderName() : null);
|
||||
// data.setContext(swaggerData.get("basePath") != null ?
|
||||
// swaggerData.get("basePath").toString() : "");
|
||||
data.setContext(oldApi.getContext());
|
||||
data.setContext(getContext(oldApi.getContext(), oldApi.getContextTemplate(), oldApi.getId().getVersion()));
|
||||
data.setLifeCycleStatus(oldApi.getStatus());
|
||||
data.setDefaultVersion(oldApi.isDefaultVersion());
|
||||
data.setRevision(false);
|
||||
@ -159,6 +161,16 @@ public class ApiDefinitionMapper32to45 {
|
||||
return newApi;
|
||||
}
|
||||
|
||||
private static String getContext(String context, String contextTemplate, String version) {
|
||||
if (contextTemplate != null && !contextTemplate.isEmpty()) {
|
||||
return contextTemplate.replace(CONTEXT_VERSION_TEMPLATE, "");
|
||||
}
|
||||
if (context != null && !context.isEmpty()) {
|
||||
return context.replace(version, "");
|
||||
}
|
||||
return context;
|
||||
}
|
||||
|
||||
private static Map mapEndpointConfig(Map endpointConfig) {
|
||||
if (endpointConfig == null || endpointConfig.isEmpty())
|
||||
return new HashMap();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user