Repository navigation
Conversation
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.
image/jpg and image/jpeg are two distinct values the API accepts, so describing JPG as an alias was misleading: the constants are not equal.
|
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 |
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.