jakartaee / jakartaee/rest

MediaType.isCompatible does not recognize media types with composite subtypes

Open
#401 10 comments 0 reactions 0 assignees View on GitHub
Component: model api
Dominant language
Java
Stars
400
Forks
143
PR merge metrics
No merged PRs in 30d

Description

application/xml+bar is compatible with application/xml+* but MediaType.isCompatible will return false on these types.

The method will need to do one extra check, "|| typesAreEqual and bothSubTypesContainPlus, if yes - split both subtypes, the values before '+' must be equal, afterwards either equal or one of them is a wildcard".

application/*+bar and application/xml+bar might also be checked - though the former case is probably more interesting/more real world one...
#### Affected Versions
[2.0]

Contributor guide

Open the contributing guide

Research direction

Start at the MediaType.isCompatible entry point and inspect how subtype equality and wildcards are currently handled. Verify composite subtypes such as application/xml+bar with application/xml+* and application/*+bar, then add or update coverage so matching prefixes and compatible suffixes are accepted while incompatible values remain false.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.