Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
BLasan committed Mar 26, 2024
1 parent 6b0a6b6 commit 3f5fdec
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 @@ -3082,6 +3082,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 3f5fdec

Please sign in to comment.