Skip to content
Open
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
754b522
Fix(final)- key manager issue for fedarated gateway
JaninduRSD Dec 22, 2025
4d3af77
creating async API definition for websocket APIs
JaninduRSD Jan 6, 2026
970cf52
versioning of discovered websocket APIs
JaninduRSD Jan 20, 2026
51d64fb
enhance
JaninduRSD Jan 21, 2026
9829528
enhance
JaninduRSD Jan 21, 2026
9be6347
enhance
JaninduRSD Jan 22, 2026
9fa4708
enhance
JaninduRSD Jan 25, 2026
e9cf7fe
Update APIMappingUtil.java
JaninduRSD Jan 25, 2026
75b7e79
Update APIMappingUtil.java
JaninduRSD Jan 25, 2026
ff54e72
Refactor context handling in APIMappingUtil
JaninduRSD Jan 25, 2026
8c84050
async API update logic
JaninduRSD Jan 26, 2026
18556eb
enhance
JaninduRSD Jan 26, 2026
3f27527
enhance
JaninduRSD Jan 27, 2026
3987e44
fix checkstly issue
JaninduRSD Jan 27, 2026
cfd56ee
fix checkstyle
JaninduRSD Jan 27, 2026
8179b2c
fix checkstyle issue
JaninduRSD Jan 27, 2026
e577028
url setting
JaninduRSD Jan 29, 2026
8534f95
enhance
JaninduRSD Jan 29, 2026
27abaa6
enhance
JaninduRSD Jan 29, 2026
35094dc
enhance
JaninduRSD Jan 29, 2026
d25c378
enhance
JaninduRSD Jan 29, 2026
6fdac53
Merge branch 'azureWS' of https://github.com/JaninduRSD/carbon-apimgt…
JaninduRSD Jan 29, 2026
b4895e2
enhance
JaninduRSD Jan 29, 2026
0e21bd6
url extraction logic
JaninduRSD Jan 30, 2026
7327209
Federated API Building
JaninduRSD Feb 12, 2026
3065b18
API Definition Handler
JaninduRSD Feb 12, 2026
2bd6bd7
async API Parse util revert
JaninduRSD Feb 12, 2026
b171396
update definition change revork
JaninduRSD Feb 12, 2026
c52cceb
API Mapping util change revork
JaninduRSD Feb 12, 2026
e47357e
implement using definition handler
JaninduRSD Feb 12, 2026
d6d03f5
enhansment
JaninduRSD Feb 12, 2026
71b2af3
enhansment
JaninduRSD Feb 12, 2026
4998f7d
enhance
JaninduRSD Feb 12, 2026
20770c3
fix checkstyle issues
JaninduRSD Feb 12, 2026
269a42b
update copyright year to 2026 in multiple files
JaninduRSD Feb 12, 2026
488e993
refine API context extraction documentation and update return type de…
JaninduRSD Feb 12, 2026
e35ee32
add missing newline at end of AsyncApiParserUtil.java
JaninduRSD Feb 12, 2026
545a7b5
enhance error handling in AsyncAPIDefinitionHandler and OASDefinition…
JaninduRSD Feb 19, 2026
f4c50cb
enhance null and empty checks for AsyncAPI and Swagger definitions in…
JaninduRSD Feb 19, 2026
2b13fd0
Refactor API Definition Handling
JaninduRSD Feb 25, 2026
16be663
Delete components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/or…
JaninduRSD Feb 25, 2026
e9820f4
Delete components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/or…
JaninduRSD Feb 25, 2026
78cb3a3
refactor APIDefinitionProcessor variable naming for consistency
JaninduRSD Feb 25, 2026
b7731c0
Merge branch 'azureWS' of https://github.com/JaninduRSD/carbon-apimgt…
JaninduRSD Feb 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
/*
* Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package org.wso2.carbon.apimgt.api;

import org.wso2.carbon.apimgt.api.model.API;
import org.wso2.carbon.apimgt.api.model.APIIdentifier;
import org.wso2.carbon.apimgt.api.model.Environment;

/**
* Abstract builder for creating WSO2 API objects from external API contracts (federated discovery).
*
* @param <T> The type of the raw data/contract from the external gateway (e.g. Azure API object, Kong API object).
*/
public abstract class FederatedAPIBuilder<T> {

/**
* Builds a WSO2 API object from the raw external data.
*
* @param sourceApi The raw data object from the external gateway.
* @param env The environment where the API is discovered.
* @param org The organization context.
* @return The constructed API object.
* @throws APIManagementException If an error occurs during building.
*/
public API build(T sourceApi, Environment env, String org) throws APIManagementException {
// 1. Basic Identification
String provider = org; // Usually defaults to the organization name
APIIdentifier apiId = new APIIdentifier(provider, getName(sourceApi), getVersion(sourceApi));

API api = new API(apiId);

// 2. Map Common Properties
api.setContext(getContext(sourceApi));
api.setContextTemplate(getContextTemplate(sourceApi));
api.setUuid(getGatewayId(sourceApi)); // Important for mapping updates later
api.setDescription(getDescription(sourceApi));

// 3. Set Standard WSO2 Flags
api.setOrganization(org);
if (env != null) {
api.setGatewayType(env.getGatewayType());
}
api.setInitiatedFromGateway(true);
api.setRevision(false);
api.setGatewayVendor("external");

// 4. Specific Mapping (Delegated to subclasses)
mapSpecificDetails(api, sourceApi, env);

return api;
}

/**
* Extracts the name of the API from the raw data.
*
* @param sourceApi The raw data object.
* @return The API name.
*/
protected abstract String getName(T sourceApi);

/**
* Extracts the version of the API from the raw data.
*
* @param sourceApi The raw data object.
* @return The API version.
*/
protected abstract String getVersion(T sourceApi);

/**
* Extracts the context/path of the API from the raw data.
*
* @param sourceApi The raw data object.
* @return The API context.
*/
protected abstract String getContext(T sourceApi);

/**
* Extracts the context/path of the API from the raw data.
*
* @param sourceApi The raw data object.
* @return The API context template.
*/
protected abstract String getContextTemplate(T sourceApi);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Javadoc for getContextTemplate is a copy-paste of getContext.

The @return tag says "The API context template" (correct), but the method description still reads "Extracts the context/path of the API" — same as getContext. Clarify that this returns the template (e.g., with {version} placeholder).

📝 Proposed Javadoc fix
     /**
-     * Extracts the context/path of the API from the raw data.
+     * Extracts the context template of the API from the raw data (e.g., context with version placeholder).
      *
      * `@param` sourceApi The raw data object.
      * `@return` The API context template.
      */
🤖 Prompt for AI Agents
In
`@components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/FederatedAPIBuilder.java`
around lines 93 - 99, Update the Javadoc on
FederatedAPIBuilder#getContextTemplate to clearly state it returns the context
template (may include placeholders like {version}) rather than the concrete
context/path; change the description line to something like "Returns the API
context template (may include placeholders such as {version})" and keep the
`@param` and `@return` tags consistent with that wording so reviewers can
distinguish this from getContext.


/**
* Extracts the unique ID (UUID) from the external gateway.
* This is used to link the WSO2 API to the External API for updates.
*
* @param sourceApi The raw data object.
* @return The unique gateway ID.
*/
protected abstract String getGatewayId(T sourceApi);

/**
* Extracts the description of the API from the raw data.
*
* @param sourceApi The raw data object.
* @return The API description.
*/
protected abstract String getDescription(T sourceApi);

/**
* Maps type-specific details (protocol, endpoints, definitions, etc.) to the API object.
*
* @param api The WSO2 API object to populate.
* @param sourceApi The raw data object.
* @throws APIManagementException If an error occurs during mapping.
*/
protected abstract void mapSpecificDetails(API api, T sourceApi, Environment env) throws APIManagementException;

/**
* Checks if this builder can handle the given raw data object.
*
* @param sourceApi The raw data object.
* @return True if this builder can handle the object, false otherwise.
*/
public abstract boolean canHandle(T sourceApi);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
/*
* Copyright (c) 2025 WSO2 LLC. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package org.wso2.carbon.apimgt.api;

import java.util.ArrayList;
import java.util.List;

/**
* Abstract factory for creating and managing FederatedAPIBuilder instances.
* This provides a gateway-agnostic way to select the appropriate builder
* for different API types (REST, WebSocket, GraphQL, etc.).
*
* Gateway-specific implementations (AzureBuilderFactory, AWSBuilderFactory, etc.)
* should extend this class and register their specific builders.
*
* @param <T> The type of raw API data from the gateway (e.g., ApiContract for Azure, RestApi for AWS)
*/
public abstract class FederatedBuilderFactory<T> {

private final List<FederatedAPIBuilder<T>> builders;

/**
* Constructor initializes the builders list.
* Subclasses should call this and then register their builders.
*/
public FederatedBuilderFactory() {
this.builders = new ArrayList<>();
}

/**
* Gets the appropriate builder for the given raw API data.
* Uses the Strategy pattern - iterates through registered builders
* and returns the first one that can handle the API type.
*
* @param sourceApi The raw API data from the gateway
* @return The builder that can handle this API type, or null if unsupported
*/
public FederatedAPIBuilder<T> getBuilder(T sourceApi) {
for (FederatedAPIBuilder<T> builder : builders) {
if (builder.canHandle(sourceApi)) {
return builder;
}
}
throw new IllegalStateException(
"No registered builder can handle the given API data");
}

/**
* Checks if the given API type is supported by any registered builder.
*
* @param sourceApi The raw API data from the gateway
* @return true if a builder can handle this API type, false otherwise
*/
public boolean isSupported(T sourceApi) {
try {
return getBuilder(sourceApi) != null;
} catch (IllegalStateException e) {
return false;
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Javadoc says getBuilder returns null for unsupported types — it actually throws IllegalStateException.

The @return on line 52 says "or null if unsupported", but the method never returns null; it throws on line 60. This misleads callers.

Additionally, isSupported (lines 70-76) uses exception-based control flow to wrap getBuilder, which is an anti-pattern for a normal expected condition (no builder found). Extract the lookup into a private helper that returns null, and have both methods delegate to it.

♻️ Proposed refactor
+    private FederatedAPIBuilder<T> findBuilder(T sourceApi) {
+        for (FederatedAPIBuilder<T> builder : builders) {
+            if (builder.canHandle(sourceApi)) {
+                return builder;
+            }
+        }
+        return null;
+    }
+
     public FederatedAPIBuilder<T> getBuilder(T sourceApi) {
-        for (FederatedAPIBuilder<T> builder : builders) {
-            if (builder.canHandle(sourceApi)) {
-                return builder;
-            }
+        FederatedAPIBuilder<T> builder = findBuilder(sourceApi);
+        if (builder != null) {
+            return builder;
         }
         throw new IllegalStateException(
-        "No registered builder can handle the given API data");
+                "No registered builder can handle the given API data");
     }
     
+    /**
+     * {`@inheritDoc`}
+     */
     public boolean isSupported(T sourceApi) {
-        try {
-            return getBuilder(sourceApi) != null;
-        } catch (IllegalStateException e) {
-            return false;
-        }
+        return findBuilder(sourceApi) != null;
     }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/**
* Gets the appropriate builder for the given raw API data.
* Uses the Strategy pattern - iterates through registered builders
* and returns the first one that can handle the API type.
*
* @param sourceApi The raw API data from the gateway
* @return The builder that can handle this API type, or null if unsupported
*/
public FederatedAPIBuilder<T> getBuilder(T sourceApi) {
for (FederatedAPIBuilder<T> builder : builders) {
if (builder.canHandle(sourceApi)) {
return builder;
}
}
throw new IllegalStateException(
"No registered builder can handle the given API data");
}
/**
* Checks if the given API type is supported by any registered builder.
*
* @param sourceApi The raw API data from the gateway
* @return true if a builder can handle this API type, false otherwise
*/
public boolean isSupported(T sourceApi) {
try {
return getBuilder(sourceApi) != null;
} catch (IllegalStateException e) {
return false;
}
}
/**
* Gets the appropriate builder for the given raw API data.
* Uses the Strategy pattern - iterates through registered builders
* and returns the first one that can handle the API type.
*
* `@param` sourceApi The raw API data from the gateway
* `@return` The builder that can handle this API type, or null if unsupported
*/
private FederatedAPIBuilder<T> findBuilder(T sourceApi) {
for (FederatedAPIBuilder<T> builder : builders) {
if (builder.canHandle(sourceApi)) {
return builder;
}
}
return null;
}
/**
* Gets the appropriate builder for the given raw API data.
* Uses the Strategy pattern - iterates through registered builders
* and returns the first one that can handle the API type.
*
* `@param` sourceApi The raw API data from the gateway
* `@return` The builder that can handle this API type, or null if unsupported
*/
public FederatedAPIBuilder<T> getBuilder(T sourceApi) {
FederatedAPIBuilder<T> builder = findBuilder(sourceApi);
if (builder != null) {
return builder;
}
throw new IllegalStateException(
"No registered builder can handle the given API data");
}
/**
* {`@inheritDoc`}
*/
public boolean isSupported(T sourceApi) {
return findBuilder(sourceApi) != null;
}
🤖 Prompt for AI Agents
In
`@components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/FederatedBuilderFactory.java`
around lines 46 - 76, The Javadoc and control flow are inconsistent: create a
private helper method (e.g., findBuilder or lookupBuilder) in
FederatedBuilderFactory that iterates the builders collection and returns the
first FederatedAPIBuilder<T> that canHandle(sourceApi) or null if none found;
change getBuilder(T sourceApi) to call that helper and throw the
IllegalStateException only when the helper returns null (and update the `@return`
Javadoc to match), and change isSupported(T sourceApi) to call the same helper
and return (helper(...) != null) instead of relying on exception-based flow.


/**
* Registers a builder in the factory.
* Subclasses can use this to add builders in their constructor.
*
* @param builder The builder to register
*/
protected void registerBuilder(FederatedAPIBuilder<T> builder) {
if (builder != null) {
// 1. Check if ANY builder in the list has the same CLASS as the new one
boolean alreadyExists = false;
for (FederatedAPIBuilder<T> existing : builders) {
if (existing.getClass().equals(builder.getClass())) {
alreadyExists = true;
break;
}
}

if (!alreadyExists) {
builders.add(builder);
}
}
}

/**
* Gets all registered builders.
* Useful for testing and debugging.
*
* @return List of all registered builders
*/
public List<FederatedAPIBuilder<T>> getRegisteredBuilders() {
return new ArrayList<>(builders); // Return a copy for safety
}

/**
* Gets the count of registered builders.
*
* @return Number of registered builders
*/
public int getBuilderCount() {
return builders.size();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,26 @@ private void processDiscoveredAPIs(List<DiscoveredAPI> apisToDeployInGatewayEnv,
JsonObject apiJson = (JsonObject) new Gson().toJsonTree(apidto);
apiJson = CommonUtil.addTypeAndVersionToFile(ImportExportConstants.TYPE_API,
ImportExportConstants.APIM_VERSION, apiJson);
String definition;
if (api.isAsync()) {
definition = api.getAsyncApiDefinition();
} else {
definition = api.getSwaggerDefinition();
}

if (definition == null || StringUtils.isBlank(definition)) {
log.warn("API definition is empty for: " + apidto.getName() + " version: "
+ apidto.getVersion());
if (log.isDebugEnabled()) {
log.debug("API type: " + apidto.getType() + ", API object: " + api.toString());
}
continue;
}

InputStream apiZip = FederatedGatewayUtil.createZipAsInputStream(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 3

Suggested change
InputStream apiZip = FederatedGatewayUtil.createZipAsInputStream(
InputStream apiZip = FederatedGatewayUtil.createZipAsInputStream(
log.info("Creating import package for API: " + apidto.getName() + " version: " + apidto.getVersion());

apiJson.toString(), api.getSwaggerDefinition(),
apiJson.toString(), definition,
FederatedGatewayUtil.createDeploymentYaml(environment),
apidto.getName());
apidto.getName(), api.isAsync());

ImportExportAPI importExportAPI = APIImportExportUtil.getImportExportAPI();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ public static API createNewAPIVersion(String apiUUID, String newVersion, String
return provider.createNewAPIVersion(apiUUID, newVersion, true, organization);
}

public static InputStream createZipAsInputStream(String apiYaml, String swaggerYaml, String deploymentYaml,
String zipName) throws IOException {
if (apiYaml == null || swaggerYaml == null || deploymentYaml == null) {
public static InputStream createZipAsInputStream(String apiYaml, String apiDefinition, String deploymentYaml,
String zipName, boolean isAsync) throws IOException {
if (apiYaml == null || apiDefinition == null || deploymentYaml == null) {
throw new IllegalArgumentException("Input parameters cannot be null for API: " + zipName);
}
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
Expand All @@ -117,8 +117,9 @@ public static InputStream createZipAsInputStream(String apiYaml, String swaggerY
// Add api.yaml
addToZip(zos, zipName + "/" + API_YAML_FILE_NAME, apiYaml);

// Add Definitions/swagger.yaml
addToZip(zos, zipName + "/" + SWAGGER_YAML_FILE_NAME, swaggerYaml);
// Add Definitions/swagger.yaml or Definitions/asyncapi.yaml
String definitionFileName = isAsync ? "Definitions/asyncapi.yaml" : SWAGGER_YAML_FILE_NAME;
addToZip(zos, zipName + "/" + definitionFileName, apiDefinition);

// Add deployment_environments.yaml
addToZip(zos, zipName + "/" + DEPLOYMENT_ENVIRONMENTS_FILE_NAME, deploymentYaml);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1338,7 +1338,7 @@ private void validateKeyManagers(API api, List<String> existingKeyManagers) thro
.forEach(validKeyManagers::add);
}
}
if (validKeyManagers.isEmpty()) {
if (validKeyManagers.isEmpty() && !api.isInitiatedFromGateway()) {
throw new APIManagementException(
Comment on lines 1340 to 1342
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 7

Suggested change
}
if (validKeyManagers.isEmpty()) {
if (validKeyManagers.isEmpty() && !api.isInitiatedFromGateway()) {
throw new APIManagementException(
}
if (validKeyManagers.isEmpty() && !api.isInitiatedFromGateway()) {
log.error("API validation failed: No valid key managers found for API: " + api.getId());
throw new APIManagementException(

"API must have at least one valid and enabled key manager configured",
ExceptionCodes.KEY_MANAGER_NOT_FOUND);
Expand Down Expand Up @@ -2623,7 +2623,8 @@ public API createNewAPIVersion(String existingApiId, String newVersion, Boolean

existingAPI.setOrganization(organization);
APIIdentifier existingAPIId = existingAPI.getId();
String existingAPISwaggerDefinition = existingAPI.getSwaggerDefinition();
String existingApiDefinition = existingAPI.isAsync() ? existingAPI.getAsyncApiDefinition()
: existingAPI.getSwaggerDefinition();
String existingAPICreatedTime = existingAPI.getCreatedTime();
String existingAPIStatus = existingAPI.getStatus();
boolean isExsitingAPIdefaultVersion = existingAPI.isDefaultVersion();
Expand All @@ -2646,7 +2647,7 @@ public API createNewAPIVersion(String existingApiId, String newVersion, Boolean
List<OperationPolicy> apiLevelPolicies = extractAndDropAPILevelPoliciesFromAPI(existingAPI);
updateMCPServerBackends(existingAPI, existingApiId, organization);
//update swagger definition with version
APIUtil.updateAPISwaggerWithVersion(existingAPI);
APIUtil.updateAPIDefinitionWithVersion(existingAPI);
API newAPI = addAPI(existingAPI);
String newAPIId = newAPI.getUuid();
cloneAPIPoliciesForNewAPIVersion(existingApiId, newAPI, operationPoliciesMap, apiLevelPolicies);
Expand Down Expand Up @@ -2703,7 +2704,11 @@ public API createNewAPIVersion(String existingApiId, String newVersion, Boolean
existingAPI.setId(existingAPIId);
existingAPI.setContext(existingContext);
existingAPI.setCreatedTime(existingAPICreatedTime);
existingAPI.setSwaggerDefinition(existingAPISwaggerDefinition);
if (existingAPI.isAsync()) {
existingAPI.setAsyncApiDefinition(existingApiDefinition);
} else {
existingAPI.setSwaggerDefinition(existingApiDefinition);
}
// update existing api with the original timestamp
existingAPI.setVersionTimestamp(existingVersionTimestamp);
if (isDefaultVersion) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12108,8 +12108,9 @@ public static SolaceConfig getSolaceConfig() {
*
* @param api The API object whose Swagger definition needs to be updated.
*/
public static void updateAPISwaggerWithVersion(API api) {
public static void updateAPIDefinitionWithVersion(API api) {
String swaggerDefinition = api.getSwaggerDefinition();
String asyncApiDefinition = api.getAsyncApiDefinition();

if (swaggerDefinition != null) {
JsonObject apiSpec = JsonParser.parseString(swaggerDefinition).getAsJsonObject();
Expand All @@ -12125,8 +12126,22 @@ public static void updateAPISwaggerWithVersion(API api) {
apiSpec.add(SWAGGER_INFO, newInfoObject);
}
api.setSwaggerDefinition(apiSpec.toString());
} else if (asyncApiDefinition != null) {
JsonObject apiSpec = JsonParser.parseString(asyncApiDefinition).getAsJsonObject();
JsonObject infoObject = apiSpec.has(SWAGGER_INFO) && apiSpec.get(SWAGGER_INFO).isJsonObject() ?
apiSpec.getAsJsonObject(SWAGGER_INFO) : null;
if (infoObject != null) {
infoObject.addProperty(SWAGGER_VER, api.getId().getVersion());
} else {
JsonObject newInfoObject = new JsonObject();
newInfoObject.addProperty(SWAGGER_TITLE, api.getId().getApiName());
newInfoObject.addProperty(SWAGGER_VER, api.getId().getVersion());
newInfoObject.addProperty(SWAGGER_DESCRIPTION, api.getDescription());
apiSpec.add(SWAGGER_INFO, newInfoObject);
}
api.setAsyncApiDefinition(apiSpec.toString());
} else {
log.error("Swagger definition is null for API: " + api.getId().getApiName());
log.error("Async API definition is null for API: " + api.getId().getApiName());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1671,6 +1671,9 @@ public static APIDTO fromAPItoDTO(API model, boolean preserveCredentials,
dto.setRevisionId(model.getRevisionId());
dto.setEnableSchemaValidation(model.isEnabledSchemaValidation());
dto.setEnableSubscriberVerification(model.isEnableSubscriberVerification());
if (StringUtils.isNotEmpty(model.getTransports())) {
dto.setTransport(Arrays.asList(model.getTransports().split(",")));
}
AdvertiseInfoDTO advertiseInfoDTO = new AdvertiseInfoDTO();
advertiseInfoDTO.setAdvertised(model.isAdvertiseOnly());
advertiseInfoDTO.setApiExternalProductionEndpoint(model.getApiExternalProductionEndpoint());
Expand Down
Loading
Loading