Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ddulaney opened this issue Oct 29, 2021 · 2 comments
Closed

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

ddulaney opened this issue Oct 29, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@ddulaney
Copy link

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!

@burimkrasniqi

This comment has been minimized.

@ddulaney
Copy link
Author

ddulaney commented Nov 1, 2021

Hey @burimkrasniqi, you probably want to open a separate issue for that. This one is about using springdoc-openapi-javadoc with @ParameterObject.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants