Skip to content

[Ruby] Support "binary" format for body parameter and response #1934

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 29, 2016
Merged

[Ruby] Support "binary" format for body parameter and response #1934

merged 4 commits into from
Jan 29, 2016

Conversation

xhh
Copy link
Contributor

@xhh xhh commented Jan 21, 2016

The "binary" format is handled as String in Ruby client.

{{/bodyParam}}

{{/bodyParam}}{{#bodyParam}}{{#isBinary}}post_body = {{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}}
post_body = post_body.pack('C*') if post_body
Copy link
Contributor

Choose a reason for hiding this comment

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

Nearly the same comment from https://github.com/swagger-api/swagger-codegen/pull/1891/files#diff-630a0645a0b3fabb89412db600734cfbR245

A array of 8bit ints is a very non-standard data format in Ruby. As a user, I would prefer post_body here without processing.

xhh added 2 commits January 25, 2016 12:47
as it seems weird to handle byte array (array of integer) in Ruby
@xhh xhh changed the title [Ruby] Support binary (byte array) for body parameter and response [Ruby] Support "binary" type for body parameter and response Jan 25, 2016
@xhh xhh changed the title [Ruby] Support "binary" type for body parameter and response [Ruby] Support "binary" format for body parameter and response Jan 25, 2016
Conflicts:
	samples/client/petstore/ruby/lib/petstore/api/pet_api.rb
@wing328
Copy link
Contributor

wing328 commented Jan 29, 2016

@jqr the PR has been updated to use string instead of array of integer to represent byte array.

wing328 added a commit that referenced this pull request Jan 29, 2016
[Ruby] Support "binary" format for body parameter and response
@wing328 wing328 merged commit 59a7507 into swagger-api:master Jan 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants