Skip to content

Regression bug on circular object references #3015

Closed
@detomarco

Description

@detomarco

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.

Activity

bnasslahsen

bnasslahsen commented on Jun 9, 2025

@bnasslahsen
Collaborator

@detomarco,

Not reproducible with 2.8.8

openapi: 3.1.0
info:
  title: OpenAPI definition
  version: v0
servers:
  - url: http://localhost:8080
    description: Generated server url
paths:
  /api/hello:
    get:
      tags:
        - hello-controller
      operationId: hello
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Subscription'
components:
  schemas:
    Account:
      type: object
      properties:
        id:
          type: string
        subs:
          type: array
          items:
            $ref: '#/components/schemas/Subscription'
    Subscription:
      type: object
      properties:
        id:
          type: string
        account:
          $ref: '#/components/schemas/Account'

Feel free to provide a Minimal, Reproducible Example - with HelloController that reproduces the problem.

This ticket will be closed, but can be reopened if your provide the reproducible sample.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidThis doesn't seem right

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Regression bug on circular object references · Issue #3015 · springdoc/springdoc-openapi