Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
BLasan committed Jul 29, 2024
1 parent 8c3b345 commit 9e22105
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3102,6 +3102,7 @@ public enum ConfigType {
public static final String SYNAPSE_POLICY_DEFINITION_EXTENSION_XML = ".xml";
public static final String CC_POLICY_DEFINITION_EXTENSION = ".gotmpl";
public static final String YAML_CONTENT_TYPE = "yaml";
public static final String J2_CONTENT_TYPE = "j2";
public static final String COMMON_OPERATION_POLICY_SPECIFICATIONS_LOCATION = "repository" + File.separator
+ "resources" + File.separator + "operation_policies" + File.separator + "specifications";
public static final String COMMON_OPERATION_POLICY_DEFINITIONS_LOCATION = "repository" + File.separator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ public Response addCommonOperationPolicy(InputStream policySpecFileInputStream,
if (org.apache.commons.lang3.StringUtils.isBlank(fileContentType)) {
fileContentType = policySpecFileDetail.getContentType().toString();
}

if (!(APIConstants.YAML_CONTENT_TYPE.equals(fileContentType) || APIConstants.J2_CONTENT_TYPE.equals(
fileContentType))) {
throw new APIManagementException("Unsupported file type for Operation Policy");
}

if (APIConstants.YAML_CONTENT_TYPE.equals(fileContentType)) {
jsonContent = CommonUtil.yamlToJson(jsonContent);
}
Expand Down

0 comments on commit 9e22105

Please sign in to comment.