PropertyCustomizer not invoked for multiple properties of same type with the same annotations.
See original GitHub issueA PropertyCustomizer is not invoked for every property where those properties have the same type and annotations.
For example with the following class (HelloController test here):
public static class ApiType {
Long a;
Long b;
String c;
// getters...
}
A PropertyCustomizer is invoked for properties ‘a’ & ‘c’ only; it is not invoked for property b (which shares the result of ‘a’).
This appears to be because the swagger generator is caching properties that share the same type and annotations and this is bypassing the type resolution process that drives the PropertyCustomizer.
Springdoc 1.5.2 Spring boot 2.4.1
Expected behavior PropertyCustomizer is invoked for every property.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
java - Multiple annotations of the same type on one element?
Obviously, I want to be able to quickly find instances of Employee by various properties of Project. I can either specify @Index twice...
Read more >Spring Custom Property Editor | Baeldung
Simply put, Spring uses property editors heavily for managing conversion between String values and custom Object types; this is based on ...
Read more >6.4 Bean manipulation and the BeanWrapper - Spring
A JavaBean is simply a class with a default no-argument constructor, which follows a naming convention where (by way of an example) a...
Read more >1.7.1 - jqwik User Guide
Test container classes, groups, example methods and property methods can be tagged using the annotation @Tag("a-tag") . You can have many tags on...
Read more >Type conversion - OWNER • Java™ properties reinvented.
OWER API supports properties conversion for primitive types and enums. ... annotations: you cannot specify two different ways to do the same thing!...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
You still can use
OpenApiCustomiser
. This is a sample code that you can adapt:In SpringFox this can be accomplished using
ModelPropertyBuilderPlugin
, which applies to every Property of a Model, regardless of whether its Type is the same as another Property. Perhaps that offers some inspiration of how it might be implemented in SpringDoc.