springdoc / springdoc-openapi

Library for OpenAPI 3 with spring-boot

Home Page:https://springdoc.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

When an entity class contains fields of Class<?> type, an infinite loop occurs

wenqiuhan opened this issue · comments

Describe the bug

I placed a variable of Class<?> type in the entity class, and used @ParameterObject annotation for the parameters in the controller. At this point, an infinite loop appeared. Here is a simple example project:springdoc-infinite-loop-bug
(This description is machine translation. If you cannot understand, please reply to me and I will try using other descriptions for translation. Sorry~~)

Student.java

package com.wenqiuhan.springdoc;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema
public class Student  {
    private Class<?> entityClass;
}

TestController.java

package com.wenqiuhan.springdoc;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("api/test")
public class TestController {
    @GetMapping("")
    public String test(@ParameterObject Student student) {
        return "ok";
    }
}

To Reproduce
Steps to reproduce the behavior:

  • What version of spring-boot you are using?
    3.2.5

  • What modules and versions of springdoc-openapi are you using?
    2.5.0

  • Provide with a sample code (HelloController) or Test that reproduces the problem
    a example project : springdoc-infinite-loop-bug

Screenshots
image