-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
[crystal] Fix some issues in crystal client templates #10629
Changes from 2 commits
9291810
638b447
961afec
28db021
42d3658
15c8edc
6439537
e6c6666
b825728
4c9ec63
00431a2
ec60ecf
d65cad2
2c17a6f
4825d2a
dce8bbb
e8242dd
acf8050
edd01d3
0192e50
210e149
e575bd2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,24 @@ | ||
class {{classname}}{{#allowableValues}}{{#enumVars}} | ||
{{{name}}} = {{{value}}}.freeze{{/enumVars}} | ||
|
||
{{/allowableValues}} | ||
{{{name}}} = {{{value}}} | ||
{{/enumVars}} {{/allowableValues}} | ||
# Builds the enum from string | ||
# @param [String] The enum value in the form of the string | ||
# @return [String] The enum value | ||
def self.build_from_hash(value) | ||
def self.build_from_hash(value : String) : String | ||
new.build_from_hash(value) | ||
end | ||
|
||
# Builds the enum from string | ||
# @param [String] The enum value in the form of the string | ||
# @return [String] The enum value | ||
def build_from_hash(value) | ||
constantValues = {{classname}}.constants.select { |c| {{classname}}::const_get(c) == value } | ||
raise "Invalid ENUM value #{value} for class #{{{classname}}}" if constantValues.empty? | ||
value | ||
def build_from_hash(value : String) : String | ||
case value | ||
{{#allowableValues}}{{#enumVars}} | ||
when {{{value}}} | ||
{{{name}}} | ||
{{/enumVars}} {{/allowableValues}} | ||
else | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion to allow trailing spaces:
|
||
raise "Invalid ENUM value #{value} for class #{{{classname}}}" | ||
end | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,7 +79,7 @@ module Petstore | |
# Deletes a pet | ||
# @param pet_id [Int64] Pet id to delete | ||
# @return [nil] | ||
def delete_pet(pet_id : Int64, api_key : String?) | ||
def delete_pet(pet_id : Int64, api_key : String? = nil) | ||
delete_pet_with_http_info(pet_id, api_key) | ||
nil | ||
end | ||
|
@@ -373,7 +373,7 @@ module Petstore | |
# Updates a pet in the store with form data | ||
# @param pet_id [Int64] ID of pet that needs to be updated | ||
# @return [nil] | ||
def update_pet_with_form(pet_id : Int64, name : String?, status : String?) | ||
def update_pet_with_form(pet_id : Int64, name : String? = nil, status : String? = nil) | ||
update_pet_with_form_with_http_info(pet_id, name, status) | ||
nil | ||
end | ||
|
@@ -432,7 +432,7 @@ module Petstore | |
# uploads an image | ||
# @param pet_id [Int64] ID of pet to update | ||
# @return [ApiResponse] | ||
def upload_file(pet_id : Int64, additional_metadata : String?, file : File?) | ||
def upload_file(pet_id : Int64, additional_metadata : String? = nil, file : File? = nil) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cyangle Is this (default to nil) also breaking change when it comes to calling the operations? If yes, please revert the change for the time being? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I missed it |
||
data, _status_code, _headers = upload_file_with_http_info(pet_id, additional_metadata, file) | ||
data | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about
raise
an error sayingmulti
is not supported in the client?