Repository navigation
Add read-only JSON aliases for record fields - #14
Merged
Merged
Conversation
Merged
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.
Record fields can now declare old JSON keys that are accepted when reading:
Rust and Python read
threadId,chatId, orconversationIdand write onlythreadId. Aliases also work when the record is inlined or used as a variant payload, and severalalias(...)attributes on one field accumulate. TypeScript types and checks, JSON Schema, and OpenAPI keep only the main name.Rationale
Isolade renamed chats to threads. Some of its records are stored as JSON and also served through its API. Without aliases, renaming such a field means either keeping the old key forever or migrating stored data. With an alias, the field gets its new name and old data keeps loading.
Behavior
threadIdandchatId, is rejected as a duplicate field.Validation
Workspace Rust tests (including native and Serde round trips through the new
aliasesschema), Python tests, TypeScript runtime tests, Clippy, formatting, and the documentation build pass.Risk Assessment
Blast Radius: Minor
The feature is opt-in. Schemas without aliases decode and encode exactly as before. A bug would affect only fields that declare aliases.
Reversibility: Easy
Users who haven't adopted aliases are unaffected by a revert. Schemas that use aliases would need to drop them.
Created on behalf of @koehlma by Claude Code / claude-opus-5-5 · Task