Skip to content

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

Closed
@wenqiuhan

Description

@wenqiuhan

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions