Skip to content

Embedded properties missing from schema in 3.1.0 with JPA and spring-boot-data-rest #3332

Description

@obecker

Describe the bug

We are running a Kotlin application with spring-boot-starter-data-rest and spring-boot-starter-data-jpa.
Spring Boot version 4.1.0
Springdoc version 3.1.0

Some entity classes have embedded properties. These properties are missing in the corresponding Open API schema definitions.

Example:

@Entity
class Person {

    @Id
    var id: Long? = null

    @Embedded
    var name: Name? = null
}

@Embeddable
class Name {
    var firstName: String? = null
    var lastName: String? = null
}

Springdoc 3.0.2 works as expected and generates

...
 "components": {
    "schemas": {
      "EntityModelPerson": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "links": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Link"
            }
          },
          "name": {
            "$ref": "#/components/schemas/Name"
          }
        }
      },
...

With Springdoc 3.1.0 both name property and Name object schema are missing.
(Note: Springdoc 3.0.3 doesn't work because of #3263)

To Reproduce
See https://github.com/obecker/springdoc-issue-demo

Run the main function in SpringdocIssueDemoApplication and open http://localhost:8080/swagger-ui/index.html

Downgrade the springdoc version in build.gradle.kts to see the old behavior.

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