Skip to content

Commit 4e327e2

Browse files
committed
Workaround swagger-api#3469 for AbstractComment hierarchy
1 parent bd73727 commit 4e327e2

File tree

1 file changed

+9
-1
lines changed
  • modules/swagger-models/src/main/java/io/swagger/v3/oas/models

1 file changed

+9
-1
lines changed

modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Components.java

+9-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import io.swagger.v3.oas.models.examples.Example;
66
import io.swagger.v3.oas.models.headers.Header;
77
import io.swagger.v3.oas.models.links.Link;
8+
import io.swagger.v3.oas.models.media.ComposedSchema;
89
import io.swagger.v3.oas.models.media.Schema;
910
import io.swagger.v3.oas.models.parameters.Parameter;
1011
import io.swagger.v3.oas.models.parameters.RequestBody;
@@ -68,7 +69,14 @@ public Components addSchemas(String key, Schema schemasItem) {
6869
if (this.schemas == null) {
6970
this.schemas = new LinkedHashMap<>();
7071
}
71-
this.schemas.put(key, schemasItem);
72+
final Schema existing = this.schemas.get(key);
73+
if (existing != null) {
74+
if (schemasItem instanceof ComposedSchema) {
75+
this.schemas.put(key, schemasItem);
76+
}
77+
} else {
78+
this.schemas.put(key, schemasItem);
79+
}
7280
return this;
7381
}
7482

0 commit comments

Comments
 (0)