-
-
Notifications
You must be signed in to change notification settings - Fork 505
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
Schema.RequiredMode.Required not working for spring mvc and kotlin #2360
Comments
Tests are following the test cases described here: If you have |
@bnasslahsen what you are writing is what I would expect, but when I run the test code that I provided that doesn't seem to be the case. As you can see in my test class, I am using
but it still shows up as required in the schema (see my test) There seems to be a discrepancy between webflux and webmvc |
Hi. Just hit this problem when migrating to springdoc from springfox, on Kotlin fields that are not nullable but have a default value: @field:Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED)
val foo: String = "default" This still gets marked as required. Are there any workarounds? EDIT: |
Describe the bug
When building the same case as the springdoc-kotlin-test module does here in a spring boot 3 webMVC app, the openAPI-spec ends up with all the fields being reported as required.
To Reproduce
I've copied the resources from the test referenced above into an example app with a (failing) test which can be found here:
https://github.com/olbpetersson/springdoc-webmvc-test/blob/main/src/test/kotlin/com/example/demo/DemoApplicationTests.kt
and can be executed via
./gradlew bootRun & ./gradlew test
Expected behavior
The fields annotated with @Schema.RequiredMode.NOT_REQUIRED should not end up in the required list. The openAPI-spec should be the same as the one in app9.json referenced above
Screenshots
Additional context
The text was updated successfully, but these errors were encountered: