11package io .swagger .v3 .core .jackson ;
22
3- import com .fasterxml .jackson .core .Version ;
4- import com .fasterxml .jackson .databind .AnnotationIntrospector ;
5- import com .fasterxml .jackson .databind .BeanDescription ;
6- import com .fasterxml .jackson .databind .JavaType ;
7- import com .fasterxml .jackson .databind .ObjectMapper ;
8- import com .fasterxml .jackson .databind .PropertyName ;
9- import com .fasterxml .jackson .databind .jsontype .NamedType ;
10- import com .fasterxml .jackson .databind .module .SimpleModule ;
3+ import tools .jackson .core .Version ;
4+ import tools .jackson .databind .AnnotationIntrospector ;
5+ import tools .jackson .databind .BeanDescription ;
6+ import tools .jackson .databind .JavaType ;
7+ import tools .jackson .databind .ObjectMapper ;
8+ import tools .jackson .databind .PropertyName ;
9+ import tools .jackson .databind .cfg .MapperBuilder ;
10+ import tools .jackson .databind .introspect .AccessorNamingStrategy ;
11+ import tools .jackson .databind .introspect .BasicBeanDescription ;
12+ import tools .jackson .databind .introspect .DefaultAccessorNamingStrategy ;
13+ import tools .jackson .databind .jsontype .NamedType ;
14+ import tools .jackson .databind .module .SimpleModule ;
1115import io .swagger .v3 .core .converter .AnnotatedType ;
1216import io .swagger .v3 .core .converter .ModelConverter ;
1317import io .swagger .v3 .core .converter .ModelConverterContext ;
@@ -33,14 +37,16 @@ protected AbstractModelConverter(ObjectMapper mapper) {
3337 }
3438
3539 protected AbstractModelConverter (ObjectMapper mapper , TypeNameResolver typeNameResolver ) {
36- mapper .registerModule (
37- new SimpleModule ("swagger" , Version .unknownVersion ()) {
40+ _mapper = mapper .rebuild ()
41+ . addModule ( new SimpleModule ("swagger" , Version .unknownVersion ()) {
3842 @ Override
3943 public void setupModule (SetupContext context ) {
4044 context .insertAnnotationIntrospector (new SwaggerAnnotationIntrospector ());
4145 }
42- });
43- _mapper = mapper ;
46+ })
47+ .accessorNaming (new DefaultAccessorNamingStrategy .Provider ()
48+ .withFirstCharAcceptance (true , true ))
49+ .build ();
4450 _typeNameResolver = typeNameResolver ;
4551 }
4652
@@ -61,7 +67,7 @@ public Schema resolve(AnnotatedType type, ModelConverterContext context, Iterato
6167 * @return the current AnnotationIntrospector
6268 */
6369 protected AnnotationIntrospector _intr () {
64- return _mapper .getSerializationConfig ().getAnnotationIntrospector ();
70+ return _mapper .serializationConfig ().getAnnotationIntrospector ();
6571 }
6672
6773 protected String _typeName (JavaType type ) {
@@ -95,10 +101,10 @@ protected String _findTypeName(JavaType type, BeanDescription beanDesc) {
95101 return "List" ;
96102 }
97103 if (beanDesc == null ) {
98- beanDesc = _mapper .getSerializationConfig ().introspectClassAnnotations (type );
104+ beanDesc = _mapper ._serializationContext ().introspectBeanDescription (type );
99105 }
100106
101- PropertyName rootName = _intr ().findRootName (beanDesc .getClassInfo ());
107+ PropertyName rootName = _intr ().findRootName (_mapper . serializationConfig (), beanDesc .getClassInfo ());
102108 if (rootName != null && rootName .hasSimpleName ()) {
103109 return rootName .getSimpleName ();
104110 }
0 commit comments