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.

Activity

  1. Mattias-Sehlstedt commented on Aug 18, 2026

    @Mattias-Sehlstedt
    Contributor

    Could be a duplicate of #3328 (as in the same cause but another symptom)?

  2. obecker commented on Aug 18, 2026

    @obecker
    Author

    Well, I'm not sure. I have initially seen the exception described in #3328, too, but could get rid of it by setting useHalAsDefaultJsonMediaType to false:

    @Configuration
    class SpringRestConfiguration : RepositoryRestConfigurer {
        override fun configureRepositoryRestConfiguration(config: RepositoryRestConfiguration, cors: CorsRegistry) {
            config.useHalAsDefaultJsonMediaType(false)
        }
    }
    
  3. Mattias-Sehlstedt commented on Aug 18, 2026

    @Mattias-Sehlstedt
    Contributor

    Well, I'm not sure. I have initially seen the exception described in #3328, too, but could get rid of it by setting useHalAsDefaultJsonMediaType to false:

    @Configuration
    class SpringRestConfiguration : RepositoryRestConfigurer {
        override fun configureRepositoryRestConfiguration(config: RepositoryRestConfiguration, cors: CorsRegistry) {
            config.useHalAsDefaultJsonMediaType(false)
        }
    }
    

    It could be that your configuration makes the processing not reach the unexpected nullpointer, but that it rather instead drops the embedded processors entirely and proceeds as if they were not even there in any sense (while the entire configuration is actually designed around them having to be there).

    Is it possible to get HateoasProperties on the classpath easily without issue in your test application? That would be the easiest way to verify, since if it exists then the application correctly loads the needed configurations from SpringDocHateoasConfiguration.

  4. obecker commented on Aug 19, 2026

    @obecker
    Author

    Hey @Mattias-Sehlstedt, I have added org.springframework.boot:spring-boot-starter-hateoas as new dependency and removed the mentioned class SpringRestConfiguration altogether (obecker/springdoc-issue-demo@244766b). Now #3328 is still not present (so adding the dependency resolves it), but also the embedded property is still missing (i.e. this issue here is still present).

  5. Mattias-Sehlstedt commented on Aug 19, 2026

    @Mattias-Sehlstedt
    Contributor

    Thanks for testing. In that case I will see if I get time to do some testing locally and see what the cause might be.

  6. Mattias-Sehlstedt commented on Aug 22, 2026

    @Mattias-Sehlstedt
    Contributor

    It looks to be a regression from b6e5212 and how it interprets nullability. If you are not relying on KotlinNullablePropertyCustomizer to produce something important in your specification, then I believe disabling that should be a functioning fallback.

    Since the currently injected magic has the same affect as upgrading swagger-core (see change to test app25 NullKeyController), I will wait until the bump is merged before making a more formal fix and maybe some targeted kotlin spring-rest regression test.

  7. added a commit that references this issue on Sep 6, 2026
    6266a24
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions