@@ -583,7 +583,7 @@ public static boolean isMapSchema(Schema schema) {
583583
584584 // additionalProperties explicitly set to false
585585 if ((schema .getAdditionalProperties () instanceof Boolean && Boolean .FALSE .equals (schema .getAdditionalProperties ())) ||
586- (schema .getAdditionalProperties () instanceof Schema && Boolean .FALSE .equals (((Schema ) schema .getAdditionalProperties ()).getBooleanSchemaValue ()))
586+ (schema .getAdditionalProperties () instanceof Schema && Boolean .FALSE .equals (((Schema ) schema .getAdditionalProperties ()).getBooleanSchemaValue ()))
587587 ) {
588588 return false ;
589589 }
@@ -726,7 +726,7 @@ public static boolean isDateTimeLocalSchema(Schema schema) {
726726 public static boolean isTimeLocalSchema (Schema schema ) {
727727 // format: time-local, see https://spec.openapis.org/registry/format/time-local.html
728728 return (SchemaTypeUtil .STRING_TYPE .equals (getType (schema ))
729- && "time-local" .equals (schema .getFormat ()));
729+ && "time-local" .equals (schema .getFormat ()));
730730 }
731731
732732 public static boolean isPasswordSchema (Schema schema ) {
@@ -845,12 +845,12 @@ public static boolean isModelWithPropertiesOnly(Schema schema) {
845845 (null != schema .getProperties () && !schema .getProperties ().isEmpty ()) &&
846846 // no additionalProperties is set
847847 (schema .getAdditionalProperties () == null ||
848- // additionalProperties is boolean and set to false
849- (schema .getAdditionalProperties () instanceof Boolean && !(Boolean ) schema .getAdditionalProperties ()) ||
850- // additionalProperties is a schema with its boolean value set to false
851- (schema .getAdditionalProperties () instanceof Schema &&
852- ((Schema ) schema .getAdditionalProperties ()).getBooleanSchemaValue () != null &&
853- !((Schema ) schema .getAdditionalProperties ()).getBooleanSchemaValue ())
848+ // additionalProperties is boolean and set to false
849+ (schema .getAdditionalProperties () instanceof Boolean && !(Boolean ) schema .getAdditionalProperties ()) ||
850+ // additionalProperties is a schema with its boolean value set to false
851+ (schema .getAdditionalProperties () instanceof Schema &&
852+ ((Schema ) schema .getAdditionalProperties ()).getBooleanSchemaValue () != null &&
853+ !((Schema ) schema .getAdditionalProperties ()).getBooleanSchemaValue ())
854854 );
855855 }
856856
@@ -989,7 +989,7 @@ public static ResolvedMaxBound resolveMaximumBound(OpenAPI openAPI, Schema<?> sc
989989 return !hasAllOf (schema )
990990 ? result
991991 : schema .getAllOf ().stream ()
992- // recursive search for smallest max bound
992+ // recursive search for smallest max bound
993993 .map (allOfItem -> resolveMaximumBound (openAPI , allOfItem ))
994994 .reduce (result , ResolvedMaxBound ::getSmallerMaxBound );
995995 }
@@ -1022,9 +1022,20 @@ public static ResolvedMinBound resolveMinimumBound(OpenAPI openAPI, Schema<?> sc
10221022
10231023 /**
10241024 * Returns the effective {@code default} for the given schema, resolving through a top-level
1025- * {@code $ref} and walking any {@code allOf} items (each resolved via their own {@code $ref}).
1026- * Unlike constraints, the inline schema's default takes precedence (explicit per-endpoint
1027- * override); falls back to the first non-null default found in {@code allOf} items.
1025+ * {@code $ref} and recursively walking any {@code allOf} items.
1026+ * The inline schema's default takes precedence (explicit per-endpoint override);
1027+ * falls back to the first non-null default found via depth-first search of {@code allOf} items.
1028+ * Circular {@code allOf} references are detected and skipped.
1029+ *
1030+ * @param openAPI the OpenAPI document used to resolve {@code $ref}s
1031+ * @param schema the schema to inspect
1032+ * @return the effective default value, or {@code null} if none is defined
1033+ */
1034+ /**
1035+ * Returns the effective {@code default} for the given schema, resolving through a top-level
1036+ * {@code $ref} and recursively walking any {@code allOf} items.
1037+ * The inline schema's default takes precedence (explicit per-endpoint override);
1038+ * falls back to the first non-null default found via depth-first search of {@code allOf} items.
10281039 *
10291040 * @param openAPI the OpenAPI document used to resolve {@code $ref}s
10301041 * @param schema the schema to inspect
@@ -1042,9 +1053,8 @@ public static Object resolveDefault(OpenAPI openAPI, Schema<?> schema) {
10421053 return !hasAllOf (schema )
10431054 ? null
10441055 : schema .getAllOf ().stream ()
1045- .map (item -> getReferencedSchema (openAPI , item ))
1046- .filter (Objects ::nonNull )
1047- .map (Schema ::getDefault )
1056+ // recursive search for default
1057+ .map (item -> resolveDefault (openAPI , item ))
10481058 .filter (Objects ::nonNull )
10491059 .findFirst ()
10501060 .orElse (null );
0 commit comments