Closed
Description
Describe the bug
- A clear and concise description of what the bug is: the title of an issue is not enough
Starting from 2.8.7
we noticed a regression bug related to circular object references.
Given these kotlin classes
data class Account(
val id: String,
val subs: List<Subscriptions>
)
data class Subscriptiong(
val id: String.
) {
var account: Account
}
To Reproduce
Steps to reproduce the behavior:
- What version of spring-boot you are using?
3.4.5 - What modules and versions of springdoc-openapi are you using?
springdoc-openapi-starter-webmvc-ui
- What is the actual and the expected result using OpenAPI Description (yml or json)?
## ACTUAL
{
"Account": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"subscriptions": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Subscription"
}
}
}
},
"Subscription": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"account": {
"required": [ ## there should be a reference to Account here
"id"
]
}
}
}
- Provide with a sample code (HelloController) or Test that reproduces the problem
Expected behavior
## EXPECTED (as in v2.8.6)
{
"Account": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"subscriptions": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Subscription"
}
}
},
},
"Subscription": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"account": {
"$ref": "#/components/schemas/Account"
}
},
},
}
}
- A clear and concise description of what you expected to happen.
- What is the expected result using OpenAPI Description (yml or json)?
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.