Skip to content

Javalin fixes and validation#20981

Merged
wing328 merged 4 commits intoOpenAPITools:masterfrom
koenlavooij:javalin-fixes-and-validation
Mar 29, 2025
Merged

Javalin fixes and validation#20981
wing328 merged 4 commits intoOpenAPITools:masterfrom
koenlavooij:javalin-fixes-and-validation

Conversation

@koenlavooij
Copy link
Contributor

@koenlavooij koenlavooij commented Mar 27, 2025

Several smaller fixes and additions to the javalin5 and javalin6 generators

  • Bugfix for having a nullable property with a default value. It is assumed the interface can have a non-nullable field as an implementation for this. However, it is required to then set the default value.

  • Adding validations to the beans (largely copied from the jaxrs implementation)

  • Adding explicit basenames in the ObjectMapper Property annotations so that we do not have to rely on ObjectMappers' property name translations

@dr4ke616, @karismann, @Zomzog, @andrewemery, @4brunu, @yutaka0m, @stefankoppier, @e5l

When a default value is present the parameter is moved to non-nullable. This works because we could replace the null with a default value. This will actually set the default value.
Option to set: `useBeanValidation` to `true`. This will insert validation rules from the `jakarta.validation` package much like it does with the spring generator.

Aso sneaked in `JsonProperty` annotations in order to more formally adhere to the name in the spec as opposed to configuring ObjectMappers in order to translate names to match the spec.
@wing328 wing328 added this to the 7.13.0 milestone Mar 29, 2025
@wing328 wing328 merged commit 5e5832d into OpenAPITools:master Mar 29, 2025
51 checks passed
@wing328
Copy link
Member

wing328 commented Mar 29, 2025

thank for the PR, which has been merged

@koenlavooij koenlavooij deleted the javalin-fixes-and-validation branch March 31, 2025 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants