feat(codecs): add xml codec and opt-in toon codec factory#160
Merged
Conversation
Adds xmlCodec to defaultCodecs so Accept/Content-Type negotiation supports XML out of the box across all adapters (http, rest, graphql, jsonrpc). Adds createToonCodec(), an opt-in factory that wires up @toon-format/toon without raffel depending on it directly, following the same injection pattern as the zod/yup/joi validation adapters.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
xmlCodec(zero dependencies) todefaultCodecssoAccept/Content-Typenegotiation supports XML out of the box across every adapter that already uses this system (adapters/http.ts,rest-middleware.ts,graphql/adapter.ts,jsonrpc.ts).createToonCodec(toon), an opt-in factory for TOON (Token-Oriented Object Notation), following the same dependency-injection pattern used by the zod/yup/joi validation adapters — raffel never imports@toon-format/toondirectly, the caller passes it in.@toon-format/toonas an optional peer dependency (and dev dependency for tests).MimeTypes.TOONfor consistency with the existingMimeTypes.XML/MimeTypes.CSV.Test plan
npx tsc/npx tsc -p tsconfig.ui.jsoncleanvitest.config.unit.ts)vitest.config.int.ts)application/xmlas a stand-in for "unsupported content type" (now genuinely supported) to useapplication/pdfinstead