Skip to content

Support Jackson 3-only consumers without using Testcontainers shaded Jackson #343

Open

Description

@lukaszgyg

Context

Jackson 3 uses tools.jackson.* for its core and databind APIs while retaining the com.fasterxml.jackson.annotation package. Applications migrating to Jackson 3 should be able to use Microcks Testcontainers without relying on a particular JSON implementation on their application classpath.

Currently MicrocksContainer uses org.testcontainers.shaded.com.fasterxml.jackson.databind.ObjectMapper, TypeReference, and the custom ArrayToStringDeserializer for REST payloads. Its model classes also use the shared com.fasterxml.jackson.annotation.JsonInclude annotation.

This works in isolation because Testcontainers relocates its Jackson 2 dependencies. The proposal is therefore about removing that internal dependency and supporting Jackson 3-only applications explicitly, not introducing an unshaded Jackson 2 dependency or replacing application-level JSON serialization.

Proposal

  • Move Microcks REST payload serialization away from Testcontainers' shaded Jackson implementation, either through a small internal JSON codec or an agreed, explicit Jackson 3 implementation/dependency variant.
  • Preserve compatibility for existing consumers who do not use Jackson 3. Keep shared com.fasterxml.jackson.annotation annotations where they remain compatible with both generations.
  • Avoid introducing a classpath requirement on unshaded com.fasterxml.jackson.core:jackson-databind on Jackson 3-only applications.

The usual Jackson 2 to Jackson 3 import substitution is not sufficient here: the code deliberately uses shaded classes whose packages are provided by Testcontainers at runtime.

Verification

Add a consumer/integration test configuration that supplies Jackson 3 but excludes Jackson 2 core and databind from the consumer classpath.

Exercise the JSON paths for secrets and webhook registration, service listing, test execution and polling, message retrieval, and daily invocation statistics. Preserve the null-omission behavior and the custom array-to-string deserialization behavior.

Related upstream context: https://github.com/microcks/microcks-testcontainers-java/blob/main/src/main/java/io/github/microcks/testcontainers/MicrocksContainer.java

🤖 Generated with Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions