Skip to content

[Question][Kotlin-Spring-CLIENT] Examples are not showing up in nested classes #20936

Open
@saurin-tech

Description

@saurin-tech

Project setup:

  • Spring Boot (3.4.3)
  • OpenApi Generator (7.12.0)
  • springdoc-openapi-starter-webmvc-ui (2.8.5)

openapi generator setup:

openApiGenerate {
    generatorName.set("kotlin-spring")
    outputDir.set("${project.layout.buildDirectory.get()}/generated")
    inputSpec.set("$projectDir/src/main/resources/contract.yaml")
    apiPackage.set("generated.api")
    modelPackage.set("generated.model")
    additionalProperties.set(
        mapOf(
            "useBeanValidation" to "true",
            "delegatePattern" to "true",
            "annotationLibrary" to "swagger2",
            "interfaceOnly" to "true",
            "sourceFolder" to "",
            "useResponseEntity" to "true",
            "useSpringBoot3" to "true",
            "schemaExampleValues" to "true"
        )
    )
}

The issue that I'm running into is that I'm unable to get example to show up properly in the openapis definitions page when the class has nested classes in the schema.

For example:

User:
      allOf:
        - $ref: '#/components/schemas/Person'
        - type: object
          properties:
            id:
              type: string
              readOnly: true
            address:
              $ref: "#/components/schemas/Address"

The output on the Openapis definitions screen looks like below

{
  "firstName": "Test",
  "lastName": "Guy",
  "middleName": null,
  "address": null
}

Schema address has been setup properly with examples. When I use swagger editor it parses the example properly. Meaning instead of address values being null I'm able to get complete address object displayed with examples.

Is there something wrong with my setup or is this a default behavior of the Kotlin-Spring generator since it does not support the allOf

Thank you for your help!

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