Repository navigation
feat: add Format constants for convert media types, including JXL - #38
Conversation
|
Heads-up: Every Maven job now fails at POM parsing, before any compilation:
Verified with a throwaway branch at Why now and not in September, when this PR was green across 64 checks: older Maven treated a duplicate plugin declaration as a warning, newer Maven treats it as a build error. The CI setup does not pin a Maven version, so the runner image moved underneath the repo. Fix is to delete one of the two Locally on Maven 3.9.15 (which still only warns) the full suite passes: 94 tests, 0 failures, including the 3 |
ebd91fd to
db15057
Compare
fc873be to
1ac2557
Compare
Adds a Format namespace of media-type string constants so the types accepted by convert() are discoverable via autocomplete, including JPEG XL (image/jxl), which the API already accepts. String constants rather than a language-level enum: the JSON body must carry the media type verbatim, and an enum would serialize as its name. Existing callers passing raw strings are unaffected. JPG documents image/jpg as the alternative spelling the API also accepts. It normalises to image/jpeg before conversion, so the two constants hold different strings but select the same format. Bumps to 1.9.0 and promotes the changelog entry out of Unreleased. The change is additive, so this is a minor release; nothing is published until the matching tag is pushed.
1ac2557 to
b9c23cd
Compare
Adds a
Formatnamespace of media-type constants so the types accepted byconvertare discoverable via autocomplete — including JPEG XL(
image/jxl), which the API already accepts but no client surfaced.image/jxlis already in the API allowlist (apps/api/src/schemas/optimizations.tsand
apps/opt-api/src/constants/content-types.ts), so this is a client-sidediscoverability change only. There is no API-side work outstanding.
Members
WEBP,PNG,JPEG,JPG,AVIF,JXL,ANY(*/*) — mirroring theAPI allowlist exactly.
Why string constants and not an enum
The JSON body has to carry the media type verbatim. A language-level enum
serializes as its name or ordinal, not
image/jxl. String constants also keepthis fully backward compatible: callers passing raw strings are unaffected.
Verification
Full suite green locally:
mvn test→ 94 tests, 0 failures, including 3 newFormatTestcases.Part of a coordinated change across all six Tinify client libraries, so the
same
FormatAPI is available in each.