From fee1e0c9aa48d2d6ca51c5a59b6610f9b83c05e9 Mon Sep 17 00:00:00 2001 From: aktoboy Date: Fri, 5 Apr 2024 12:54:59 +0530 Subject: [PATCH] Added changes to use example values in path parameters --- .../open_api/parser/parameter_parser/PathParamParser.java | 6 +++++- 1 file changed, 5 insertions(+), 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 48dc0227ba..952a80075f 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,11 @@ private static String replacePathParameterUtil(String path, Parameter parameter) String type = schema.getType(); String format = schema.getFormat(); - if ("integer".equalsIgnoreCase(type)) { + String example = schema.getExample() != null ? String.valueOf(schema.getExample()) : null; + if(example != null) { + replacement = example; + } + else if ("integer".equalsIgnoreCase(type)) { replacement = "INTEGER"; } else if ("string".equalsIgnoreCase(type)) { if ("uuid".equalsIgnoreCase(format)) {