Skip to content

Replace Jackson DataformatYaml with SnakeYaml#205

Open
agrgr wants to merge 2 commits intomainfrom
CLIENT-4357-jackson-dataformat-yaml-3
Open

Replace Jackson DataformatYaml with SnakeYaml#205
agrgr wants to merge 2 commits intomainfrom
CLIENT-4357-jackson-dataformat-yaml-3

Conversation

@agrgr
Copy link
Copy Markdown
Collaborator

@agrgr agrgr commented Mar 16, 2026

No description provided.

@agrgr agrgr requested a review from tim-aero March 16, 2026 15:55
@agrgr agrgr marked this pull request as ready for review March 16, 2026 15:56
@agrgr
Copy link
Copy Markdown
Collaborator Author

agrgr commented Mar 16, 2026

@tim-aero, this dependency has another branch for versions 3.0+ (relocated to tools.jackson.dataformat:jackson-dataformat-yaml) with the future support, the current branch has LTS but will eventually discontinued at some point. The 3.0+ versions require Java 17+, are there any plans to update Java Object Mapper to support it?

@agrgr
Copy link
Copy Markdown
Collaborator Author

agrgr commented Mar 18, 2026

@tim-aero, another question is whether we should use SnakeYAML directly (which continues to support Java 8). If yes, we will need to check what to rewrite and how feasible is that.

Copy link
Copy Markdown
Contributor

@tim-aero tim-aero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like organizationally we're moving towards SnakeYaml, we probably should see if moving this to SnakeYaml is easy while we're touching it anyway.

@agrgr agrgr changed the title Update Jackson Dataformat Yaml to 2.21.1 Replace Jackson DataformatYaml with SnakeYaml Mar 23, 2026
@agrgr
Copy link
Copy Markdown
Collaborator Author

agrgr commented Mar 23, 2026

@tim-aero, the replace is done.
It should be noted that any downstream consumer whose code says catch (JsonProcessingException ...) or catch (IOException ...) around a withConfiguration(String, ...) call will get a compile error (a checked exception that no code path can throw).

So far the cleanest solution looks like accepting the break, maybe additionally documenting it. SnakeYAML throws YAMLException, which is unchecked. Dropping the checked exception looks as a natural outcome of the migration. If we do this together with bumping the version and documenting the breaking change of exception type, zero code changes needed.
An alternative would be catching YAMLException and re-throw as IOException. This keeps callers who previously caught IOException (the parent of JsonProcessingException) have it working without modification. Callers who specifically caught JsonProcessingException (not just IOException) would still have a breaking change.

Other than that, there is jackson-databind dependency used in tests only, previously it was a transitive dependency brought by Jackson DataformatYaml. So far I left it without replacing, theoretically it can be replaced with Gson or perhaps something else, or maybe with a native solution which will likely require more changes.

@agrgr agrgr requested a review from tim-aero March 23, 2026 16:38
Copy link
Copy Markdown
Contributor

@tim-aero tim-aero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants