Skip to content
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

Narrow types to format specific (e.g. CBORMapper) when resolving via JAX-RS Providers #36

Closed
kdubb opened this issue Nov 18, 2024 · 2 comments
Labels
Milestone

Comments

@kdubb
Copy link

kdubb commented Nov 18, 2024

Currently, JacoksonCBORProvider (maybe others) use ObjectMapper when resolving the mapper via the JAX-RS Provider functionality. This leads to it choosing JSON (via default ObjectMapper) in a variety of ways, none of which Jackson can assume all the blame for.

Using CBORMapper (or other specific derivations) would allow much easier selection of mappers for media types without them getting confused. Notably, JacksonYAMLProvider already does this, resolving specifically a YAMLMapper.

The use case is motivated by our recent breakage revelation that our custom configured CBORMapper was not being applied even though we register a ContextResolver for CBORMapper; the use of ObjectMapper during resolution fails to find it.

@cowtowncoder
Copy link
Member

Ok, this would make sense, especially given that by now every format module does have their own ObjectMapper sub-type -- in fact, there is even JsonMapper for explicit JSON-support (but plain ObjectMapper does, for legacy/compatibility reason, read/write JSON).

But the obvious question is whether change could be done in a backwards-compatible way. I think it can, will see if I can get a PR done.

@cowtowncoder
Copy link
Member

Ah. This must have been due to legacy reasons: once upon a time CBOR- and Smile-formats did not have matching mapper sub-types, which is why configuration could not refer to those. This has long since (2.10?) been resolved, but things were not retrofitted.

I have #37 to fix this, for 2.19(.0).

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

No branches or pull requests

2 participants