Skip to content

springdoc-openapi-javadoc doesn't work with @ParameterObject #1324

Closed
@ddulaney

Description

@ddulaney

Describe the bug
I'm using springdoc-openapi-javadoc to generate descriptions from my docs (kdocs, since I'm using Kotlin). It works great for the most part, but it isn't pulling docs from @ParameterObject classes.

To Reproduce
Steps to reproduce the behavior:

  • What version of spring-boot you are using?
    2.5.5

  • What modules and versions of springdoc-openapi are you using?

plugins {
    id("org.springdoc.openapi-gradle-plugin") version "1.3.3"
}

dependencies {
    // OpenAPI
    implementation("org.springdoc:springdoc-openapi-ui:1.5.11")
    implementation("org.springdoc:springdoc-openapi-kotlin:1.5.11")
    // Expand Pageable into page, size, sort
    implementation("org.springdoc:springdoc-openapi-data-rest:1.5.11")
    // Pull documentation from kdocs
    implementation("org.springdoc:springdoc-openapi-javadoc:1.5.11")
    kapt("com.github.therapi:therapi-runtime-javadoc-scribe:0.12.0")
}
  • Provide with a sample code (HelloController) or Test that reproduces the problem
/**
 * Gets a list of things.
 */
@GetMapping
fun getThings(@ParameterObject params: MyParams) = ...

data class MyParams(
    /**
     * My query param description.
     */
    val myQueryParam: String? = null
)

Note that it does work if I use @Parameter like this:

data class MyParams(
    @field:Parameter(description = "My query param description.")
    val myQueryParam: String? = null
)

Expected behavior

I would expect the kdocs from my @ParameterObject to be used as the parameter descriptions.
Here's what I'm hoping for:

{
  "/v1/things": {
    "get": {
      "description": "Gets a list of things.",
      "operationId": "getThings",
      "parameters": [
        {
          "name": "myQueryParam",
          "in": "query",
          "description": "My query param description.",
          "required": false,
          "schema": {
            "type": "string"
          }
        }
      ]
    }
  }
}

But here's what I'm getting:

{
  "/v1/things": {
    "get": {
      "description": "Gets a list of things.",
      "operationId": "getThings",
      "parameters": [
        {
          "name": "myQueryParam",
          "in": "query",
          "required": false,
          "schema": {
            "type": "string"
          }
        }
      ]
    }
  }
}

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions