fix(macros): flatten struct parameters to remove confusing wrapper - #58
Merged
Conversation
Single struct parameters now deserialize from entire args object instead of
requiring nested "params" key. AI agents send {"name": "Alice"} directly
instead of {"params": {"name": "Alice"}}.
- Add smart type detection (primitives vs custom structs)
- Flatten custom structs, extract primitives by name
- Add runtime tests validating flattening behavior
- Update hello-world example docs
BREAKING CHANGE: Single struct parameter handling changed
Bumps version to 0.11.0
Code Coverage Report 📊Local Coverage: 19.64%
Coverage Details📋 Full Report: View on Codecov |
PR Validation ResultsQuick Validation: ✅
Summary: ✅ All checks passed |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Problem
Single struct parameters had a mismatch between schema and runtime:
{"properties": {"message": ..., "count": ...}}{"params": {"message": ..., "count": ...}}Solution
Implemented smart parameter detection:
Changes
is_primitive_or_std_type()helperextract_parameters()for single struct handlinggenerate_method_call_with_params()with same logicTesting
✅ All 180+ tests passing
test_struct_parameter_flattening_at_runtime- validates flat args work, nested failstest_multi_param_still_works- ensures multi-param unchangedtest_optional_struct_fields_work- tests optional field handlingBreaking Change
Single struct parameter handling changed. AI agents now send:
{"name": "Alice", "greeting": "Hi"}Instead of:
{"params": {"name": "Alice", "greeting": "Hi"}}Version
Bumps to 0.11.0