Skip to content

Commit 4d7d4d0

Browse files
committed
Changes report: Generating doc for entities with map attribute does not work. Fixes #1634
1 parent 9bfcce3 commit 4d7d4d0

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

springdoc-openapi-starter-common/src/main/java/org/springdoc/core/data/DataRestResponseService.java

+8-2
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,10 @@ private Type getTypeForWildcardType(RequestMethod requestMethod, DataRestReposit
298298
ParameterizedType wildcardTypeUpperBound = (ParameterizedType) wildcardType.getUpperBounds()[0];
299299
if (RepresentationModel.class.equals(wildcardTypeUpperBound.getRawType())) {
300300
Class<?> type = findType(requestMethod, dataRestRepository);
301-
return resolveGenericType(ResponseEntity.class, type, returnedEntityType);
301+
if (MapModel.class.equals(type))
302+
return ResolvableType.forClassWithGenerics(ResponseEntity.class, type).getType();
303+
else
304+
return resolveGenericType(ResponseEntity.class, type, returnedEntityType);
302305
}
303306
}
304307
return null;
@@ -318,7 +321,10 @@ private Type getTypeForParameterizedType(RequestMethod requestMethod, DataRestRe
318321
Class<?> rawType = ResolvableType.forType(parameterizedType1.getRawType()).getRawClass();
319322
if (rawType != null && rawType.isAssignableFrom(RepresentationModel.class)) {
320323
Class<?> type = findType(requestMethod, dataRestRepository);
321-
return resolveGenericType(ResponseEntity.class, type, returnedEntityType);
324+
if (MapModel.class.equals(type))
325+
return ResolvableType.forClassWithGenerics(ResponseEntity.class, type).getType();
326+
else
327+
return resolveGenericType(ResponseEntity.class, type, returnedEntityType);
322328
}
323329
else if (EntityModel.class.equals(parameterizedType1.getRawType())) {
324330
return resolveGenericType(ResponseEntity.class, EntityModel.class, returnedEntityType);

0 commit comments

Comments
 (0)