Skip to content
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

springdoc-openapi-starter-webmvc-ui 2.8.3 does not generate "required" properties #2871

Open
gertjanschouten opened this issue Jan 21, 2025 · 2 comments

Comments

@gertjanschouten
Copy link

Since upgrading to springdoc-openapi-starter-webmvc-ui 2.8.3 (in combination with spring boot 3.4.1), properties are no longer marked as "required" in the generated openapi spec. All properties are still there, it's just that the entire "requires" list of required properties is no longer there.

For example, in 2.7.0, you would get this:

      "MyObject": {
        "type": "object",
        "properties": {
          "property1": {
            "type": "string"
          },
          "property2": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "property1"
        ]
      }

Then, in 2.8.3, it becomes this:

      "MyObject": {
        "type": "object",
        "properties": {
          "property1": {
            "type": "string"
          },
          "property2": {
            "type": "string",
            "format": "uuid"
          }
        }
      }

We had to revert to 2.7.0 for the time being.

@Mattias-Sehlstedt
Copy link

Could you provide an example of how the model looks in code?

@gertjanschouten
Copy link
Author

data class MyObject(
  val property1: String,
  val property2: UUID?
)

So basically, it relies on Kotlin's nullable syntax. Sorry, I didn't mention this before, I forgot :) This always used to work up until 2.7.0

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

No branches or pull requests

2 participants