Skip to content

feat: add the collection, primitive and no-content send methods - #155

Merged
Vincent Biret (baywet) merged 1 commit into
microsoft:mainfrom
andreaTP:feat/request-adapter-send-methods
Sep 17, 2026
Merged

Vincent Biret (baywet) merged 1 commit into
microsoft:mainfrom
andreaTP:feat/request-adapter-send-methods

Conversation

@andreaTP

Copy link
Copy Markdown
Contributor
  • the request adapter only knew how to return a single object, so every other response shape either raised or silently returned the wrong thing
  • enum and enum collection responses are read through the enum getters, matching how the other generators route them to the primitive send methods
  • get_enum_value resolved nothing: it symbolized the raw wire value instead of looking it up in the enum, so "blue" came back as :blue rather than :Blue
  • get_collection_of_enum_values did not exist, so an enum array fell through to the untyped passthrough and returned raw strings
  • an empty body no longer needs a content type, so a 204 stops raising on every send method rather than only the void one

- the request adapter only knew how to return a single object, so every other response shape either raised or silently returned the wrong thing
- enum and enum collection responses are read through the enum getters, matching how the other generators route them to the primitive send methods
- get_enum_value resolved nothing: it symbolized the raw wire value instead of looking it up in the enum, so "blue" came back as :blue rather than :Blue
- get_collection_of_enum_values did not exist, so an enum array fell through to the untyped passthrough and returned raw strings
- an empty body no longer needs a content type, so a 204 stops raising on every send method rather than only the void one

@baywet Vincent Biret (baywet) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

@baywet
Vincent Biret (baywet) merged commit 85ee08b into microsoft:main Sep 17, 2026
70 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Empty binary responses return an empty stream, and new adapter calls do not fully match the parse-node abstraction signatures.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds request adapter support for object collections, primitive values, enums, and empty responses.

Changes:

  • Adds send-method implementations and abstraction contracts.
  • Adds enum resolution and collection parsing.
  • Adds coverage for new response shapes and 204 responses.
File summaries
File Description
components/http/lib/.../faraday_request_adapter.rb Dispatches response parsing by return type.
components/serialization/json/lib/.../json_parse_node.rb Resolves scalar and collection enums.
components/abstractions/lib/.../request_adapter.rb Defines new send-method contracts.
components/abstractions/lib/.../parse_node.rb Adds enum collection parsing contract.
components/http/spec/.../send_methods_spec.rb Tests send methods and empty responses.
components/serialization/json/spec/json_enum_spec.rb Tests enum parsing.
.rubocop_todo.yml Adjusts class-length allowance.
Review details
  • Files reviewed: 7/7 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.


PRIMITIVE_READERS = {
'String' => :get_string_value,
'Float' => :get_float_value,
root_node = get_root_parse_node(response)
next root_node&.get_collection_of_enum_values(type) if type.is_a?(Hash)

root_node&.get_collection_of_primitive_values(type)
Comment on lines +87 to +89
execute_async(request_info, errors_mapping) do |response|
next StringIO.new(response.body.to_s) if type == StringIO
next get_root_parse_node(response)&.get_enum_value(type) if type.is_a?(Hash)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants