fix: camelize nested keys in read action typed map metadata#63
Merged
Torkan merged 1 commit intoash-project:mainfrom Apr 14, 2026
Merged
Conversation
Collaborator
|
Thanks for spotting this one! 😄 I'll merge it as-is, but also follow up with some minor changes to ensure that composite types without constraints, like |
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
Fixes #62
When a read action has metadata containing typed maps (e.g.,
{:array, :map}with field constraints), the codegen correctly generates camelCase TypeScript types, but the runtime RPC response returns snake_case nested keys. Mutation metadata is unaffected because it follows a separate formatting path throughformat_field_names/2.Root cause
do_add_read_metadatamerges raw metadata values into the result record. The record then goes throughOutputFormatter.format_map, which looks up each key viaResourceFields.get_public_field_type_info. Since metadata fields aren't resource attributes, the type comes back asnil, andValueFormatter.format/5short-circuits, returning nested map values with their original atom keys unchanged.Fix
Apply
format_field_names/2to each metadata value indo_add_read_metadatabefore merging into the record. This recursively camelizes nested map keys while leaving the metadata keys as atoms forOutputFormatterto handle in Stage 4, consistent with how resource attribute keys are formatted.Scalar metadata values (strings, integers, booleans) pass through
format_field_namesunchanged via theother -> otherclause, so existing behavior is preserved.Contributor checklist
Leave anything that you believe does not apply unchecked.