From 46f73e953d489d6382c0761dcdb04c3e268e9d3f Mon Sep 17 00:00:00 2001 From: aktoboy Date: Fri, 12 Apr 2024 14:31:38 +0530 Subject: [PATCH 1/2] Added changes to extract example from parameter --- .../akto/open_api/parser/parameter_parser/PathParamParser.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/utils/src/main/java/com/akto/open_api/parser/parameter_parser/PathParamParser.java b/libs/utils/src/main/java/com/akto/open_api/parser/parameter_parser/PathParamParser.java index 952a80075f..d327e7adf8 100644 --- a/libs/utils/src/main/java/com/akto/open_api/parser/parameter_parser/PathParamParser.java +++ b/libs/utils/src/main/java/com/akto/open_api/parser/parameter_parser/PathParamParser.java @@ -35,7 +35,7 @@ private static String replacePathParameterUtil(String path, Parameter parameter) String type = schema.getType(); String format = schema.getFormat(); - String example = schema.getExample() != null ? String.valueOf(schema.getExample()) : null; + String example = schema.getExample() != null ? parameter.getExample() != null ? String.valueOf(schema.getExample()) : null: null; if(example != null) { replacement = example; } From e7a5295722b22f9e5a12952c5ecb38a33203f59a Mon Sep 17 00:00:00 2001 From: aktoboy Date: Fri, 12 Apr 2024 14:55:45 +0530 Subject: [PATCH 2/2] Fixed logic --- .../akto/open_api/parser/parameter_parser/PathParamParser.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/utils/src/main/java/com/akto/open_api/parser/parameter_parser/PathParamParser.java b/libs/utils/src/main/java/com/akto/open_api/parser/parameter_parser/PathParamParser.java index d327e7adf8..5e2bedacca 100644 --- a/libs/utils/src/main/java/com/akto/open_api/parser/parameter_parser/PathParamParser.java +++ b/libs/utils/src/main/java/com/akto/open_api/parser/parameter_parser/PathParamParser.java @@ -35,7 +35,7 @@ private static String replacePathParameterUtil(String path, Parameter parameter) String type = schema.getType(); String format = schema.getFormat(); - String example = schema.getExample() != null ? parameter.getExample() != null ? String.valueOf(schema.getExample()) : null: null; + String example = schema.getExample() != null ? String.valueOf(schema.getExample()) : parameter.getExample() != null ? String.valueOf(parameter.getExample()): null; if(example != null) { replacement = example; }