@@ -560,7 +560,7 @@ private boolean isPathParamDefined(String pathParam, List<Parameter> parameters)
560560 return false ;
561561 } else {
562562 Parameter pathParamDefined = parameters .stream ()
563- .filter (parameter -> pathParam .equals (parameter .getName ()) && "path" .equals (parameter .getIn ()))
563+ .filter (parameter -> ( parameter . get$ref () != null ) || ( pathParam .equals (parameter .getName ()) && "path" .equals (parameter .getIn () )))
564564 .findFirst ()
565565 .orElse (null );
566566 if (pathParamDefined == null ) {
@@ -1657,6 +1657,7 @@ public Header getHeader(ObjectNode headerNode, String location, ParseResult resu
16571657 return header ;
16581658 }
16591659
1660+
16601661 public Object getAnyExample (String nodeKey ,ObjectNode node , String location , ParseResult result ){
16611662 JsonNode example = node .get (nodeKey );
16621663 if (example != null ) {
@@ -1673,7 +1674,6 @@ public Object getAnyExample(String nodeKey,ObjectNode node, String location, Par
16731674 BigDecimal bigDecimalExample = getBigDecimal (nodeKey , node , false , location , result );
16741675 if (bigDecimalExample != null ) {
16751676 return bigDecimalExample ;
1676-
16771677 }
16781678 }
16791679 } else if (example .getNodeType ().equals (JsonNodeType .OBJECT )) {
@@ -1686,6 +1686,11 @@ public Object getAnyExample(String nodeKey,ObjectNode node, String location, Par
16861686 if (arrayValue != null ) {
16871687 return arrayValue ;
16881688 }
1689+ } else if (example .getNodeType ().equals (JsonNodeType .BOOLEAN )){
1690+ Boolean bool = getBoolean (nodeKey ,node ,false ,location ,result );
1691+ if (bool != null ){
1692+ return bool ;
1693+ }
16891694 }
16901695 }
16911696 return null ;
@@ -2250,12 +2255,41 @@ public Schema getSchema(ObjectNode node, String location, ParseResult result){
22502255 schema .setFormat (value );
22512256 }
22522257
2253- value = getString ("default" , node , false , location , result );
2254- if (StringUtils .isNotBlank (value )) {
2255- schema .setDefault (value );
2258+ //sets default value according to the schema type
2259+ if (node .get ("default" )!= null ) {
2260+ if (schema .getType ().equals ("array" )) {
2261+ ArrayNode array = getArray ("default" , node , false , location , result );
2262+ if (array != null ) {
2263+ schema .setDefault (array );
2264+ }
2265+ }else if (schema .getType ().equals ("string" )) {
2266+ value = getString ("default" , node , false , location , result );
2267+ if (value != null ) {
2268+ schema .setDefault (value );
2269+ }
2270+ }else if (schema .getType ().equals ("boolean" )) {
2271+ bool = getBoolean ("default" , node , false , location , result );
2272+ if (bool != null ) {
2273+ schema .setDefault (bool );
2274+ }
2275+ }else if (schema .getType ().equals ("object" )) {
2276+ Object object = getObject ("default" , node , false , location , result );
2277+ if (object != null ) {
2278+ schema .setDefault (object );
2279+ }
2280+ } else if (schema .getType ().equals ("integer" )) {
2281+ Integer number = getInteger ("default" , node , false , location , result );
2282+ if (number != null ) {
2283+ schema .setDefault (number );
2284+ }
2285+ } else if (schema .getType ().equals ("number" )) {
2286+ BigDecimal number = getBigDecimal ("default" , node , false , location , result );
2287+ if (number != null ) {
2288+ schema .setDefault (number );
2289+ }
2290+ }
22562291 }
22572292
2258- //discriminator
22592293
22602294 bool = getBoolean ("nullable" , node , false , location , result );
22612295 if (bool != null ) {
0 commit comments