Open
Conversation
Author
Author
Tishka17
reviewed
Jan 25, 2026
| for f in fields_out | ||
| if f.dest == FieldDestination.BODY_PART | ||
| } | ||
| stub_dataclass = make_dataclass("StubDataclass", types.items()) |
Member
There was a problem hiding this comment.
I do not think it is a good idea to create class inside method. Can't we just dump each field separately?
Author
There was a problem hiding this comment.
We can, but then name_mapping from adaptix.Retort wont work on field names. I dont know how to implement this with a field-value dictionary and a field-type dictionary without creating a dataclass in place
Member
There was a problem hiding this comment.
We do not need name_mapping here as we explicitly set field name in BodyPart()
Tishka17
reviewed
Jan 25, 2026
Tishka17
reviewed
Jan 25, 2026
- Split the body of `JsonRPCBuilder._add_default_request_body_transformers` into several methods - Same with `RestBuilder._add_default_request_body_transformers`
K1rL3s
commented
Jan 26, 2026
|
Tishka17
reviewed
Jan 26, 2026
| ), | ||
| ] | ||
| return [] | ||
| class BodyPart(DestTransformer): |
Member
There was a problem hiding this comment.
I'd rather call it BodyField so not to mix up with other parts like files or chunks
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.





Feature: Assemble Request Body from Arguments
This PR adds the ability to construct a request body from multiple, individual function arguments.
Problem Solved
The main goal is to avoid needing a separate
dataclassfor simple request bodies.Before, creating a request body required passing a single model object. This is inconvenient for APIs that expect a flat JSON object, as it forces the creation of a new class just for the body schema. This PR allows defining body fields directly as function arguments.
Implementation Details
The implementation uses two new request transformers:
BodyPartandBodyPartDump.BodyPartTransformerBodyPart("arg_name")transformer maps a function argument to a field in the request body.BodyPartadds its key-value pair to therequest.bodydictionary.BodyPartDumpTransformerRestBuilderandJsonRPCBuilderautomatically add theBodyPartDumptransformer whenBodyPartarguments are detected.dumper(likeadaptix.Retort).dataclassfrom the collectedBodyPartarguments and their types.snake_casetocamelCase).Example