Class PropertyNamingStrategyConverter
- All Implemented Interfaces:
io.swagger.v3.core.converter.ModelConverter
PropertyNamingStrategy (for example SNAKE_CASE) is in
effect.
swagger-core's ModelResolver carries a long-standing workaround
(swagger-core#415)
that overwrites the Jackson-translated property name with the raw member name whenever
that member name starts with get/is followed by a lower-case character.
For Java records the accessor is named exactly like the component (e.g.
issuanceDate()), so a component such as issuanceDate is clobbered back
to camelCase while sibling properties like familyName convert correctly. This
converter restores the translated name.
The mapper used by the active ModelResolver is consulted so that the fix is
self-consistent: it only renames a property when Jackson actually maps its internal
name to a different external name and swagger-core emitted the internal name.
- Author:
- bnasslahsen
-
Constructor Summary
ConstructorsConstructorDescriptionPropertyNamingStrategyConverter(ObjectMapperProvider springDocObjectMapper) Instantiates a new Property naming strategy converter. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.swagger.v3.core.converter.ModelConverter
isOpenapi31
-
Constructor Details
-
PropertyNamingStrategyConverter
Instantiates a new Property naming strategy converter.- Parameters:
springDocObjectMapper- the spring doc object mapper
-
-
Method Details
-
resolve
public io.swagger.v3.oas.models.media.Schema resolve(io.swagger.v3.core.converter.AnnotatedType type, io.swagger.v3.core.converter.ModelConverterContext context, Iterator<io.swagger.v3.core.converter.ModelConverter> chain) - Specified by:
resolvein interfaceio.swagger.v3.core.converter.ModelConverter
-