Skip to content

jackson module not working in 2.2.30 #4903

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

Open
AnneJacquet opened this issue May 19, 2025 · 0 comments
Open

jackson module not working in 2.2.30 #4903

AnneJacquet opened this issue May 19, 2025 · 0 comments

Comments

@AnneJacquet
Copy link

I'm not using swagger-core directly but using springdoc-openapi-starter-webmvc-ui (2.8.8) and springwolf-kafka (1.13.0) and both are using swagger-core-jakarta (2.2.30).

Since using those versions, I have the following error when trying to access swagger :

com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Java 8 optional type `java.util.Optional` not supported by default: add Module "com.fasterxml.jackson.datatype:jackson-datatype-jdk8" to enable handling (through reference chain: io.swagger.v3.oas.models.OpenAPI["paths"]->io.swagger.v3.oas.models.Paths["/api/v1/organizations"]->io.swagger.v3.oas.models.PathItem["get"]->io.swagger.v3.oas.models.Operation["parameters"]->java.util.ArrayList[2]->io.swagger.v3.oas.models.parameters.Parameter["schema"]->io.swagger.v3.oas.models.media.JsonSchema["default"])
	at com.fasterxml.jackson.databind.exc.InvalidDefinitionException.from(InvalidDefinitionException.java:77)
	at com.fasterxml.jackson.databind.SerializerProvider.reportBadDefinition(SerializerProvider.java:1340)
	at com.fasterxml.jackson.databind.ser.impl.UnsupportedTypeSerializer.serialize(UnsupportedTypeSerializer.java:35)
	at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:732)
	at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:770)
	at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:184)
	at io.swagger.v3.core.jackson.Schema31Serializer.serialize(Schema31Serializer.java:42)
	at io.swagger.v3.core.jackson.Schema31Serializer.serialize(Schema31Serializer.java:12)

I do have the Jdk8Module :

  @Bean
  Jackson2ObjectMapperBuilderCustomizer jsonCustomizer() {
    return builder -> builder
      .modulesToInstall(new JavaTimeModule(), new Jdk8Module())
     ...
     ;
  }

When forcing swagger-core-jakarta to version 2.2.29 in my pom.xml, everything works fine.

Is there something to change to have it working with 2.2.30 ?
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant