You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a interface and model:
@RepositoryRestResource
public interface PersonRepository extends MongoRepository<Person, String> {
}
public class Person { @id
public String id;
public String name;
@DocumentReference
public Map<String, Person> friends = new HashMap<>();
}
Start app and open http://localhost:8080/swagger-ui/index.html
causes the following error:
2022-04-26 22:31:23.236 ERROR 93367 --- [nio-8080-exec-6] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.IllegalArgumentException: Mismatched number of generics specified for private static class org.springdoc.data.rest.core.DataRestResponseService$MapModel] with root cause
java.lang.IllegalArgumentException: Mismatched number of generics specified for private static class org.springdoc.data.rest.core.DataRestResponseService$MapModel
at org.springframework.util.Assert.isTrue(Assert.java:139) ~[spring-core-5.3.19.jar:5.3.19]
at org.springframework.core.ResolvableType.forClassWithGenerics(ResolvableType.java:1088) ~[spring-core-5.3.19.jar:5.3.19]
at org.springframework.core.ResolvableType.forClassWithGenerics(ResolvableType.java:1074) ~[spring-core-5.3.19.jar:5.3.19]
at org.springdoc.data.rest.core.DataRestResponseService.resolveGenericType(DataRestResponseService.java:361) ~[springdoc-openapi-data-rest-1.6.8.jar:1.6.8]
The text was updated successfully, but these errors were encountered:
Generating doc for entities with map attribute does not work
Create a SpringBoot project with jdk17 at
https://start.spring.io/#!type=gradle-project&language=java&platformVersion=2.6.7&packaging=jar&jvmVersion=17&groupId=com.example&artifactId=demo&name=demo&description=Demo%20project%20for%20Spring%20Boot&packageName=com.example.demo&dependencies=data-rest,data-mongodb,web
Add dependencies:
implementation 'org.springdoc:springdoc-openapi-ui:1.6.8'
implementation 'org.springdoc:springdoc-openapi-data-rest:1.6.8'
Create a interface and model:
@RepositoryRestResource
public interface PersonRepository extends MongoRepository<Person, String> {
}
public class Person {
@id
public String id;
public String name;
}
causes the following error:
2022-04-26 22:31:23.236 ERROR 93367 --- [nio-8080-exec-6] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.IllegalArgumentException: Mismatched number of generics specified for private static class org.springdoc.data.rest.core.DataRestResponseService$MapModel] with root cause
java.lang.IllegalArgumentException: Mismatched number of generics specified for private static class org.springdoc.data.rest.core.DataRestResponseService$MapModel
at org.springframework.util.Assert.isTrue(Assert.java:139) ~[spring-core-5.3.19.jar:5.3.19]
at org.springframework.core.ResolvableType.forClassWithGenerics(ResolvableType.java:1088) ~[spring-core-5.3.19.jar:5.3.19]
at org.springframework.core.ResolvableType.forClassWithGenerics(ResolvableType.java:1074) ~[spring-core-5.3.19.jar:5.3.19]
at org.springdoc.data.rest.core.DataRestResponseService.resolveGenericType(DataRestResponseService.java:361) ~[springdoc-openapi-data-rest-1.6.8.jar:1.6.8]
The text was updated successfully, but these errors were encountered: