-
Notifications
You must be signed in to change notification settings - Fork 463
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
param: Consider default_value: nil as valid config #894
param: Consider default_value: nil as valid config #894
Conversation
When using `param` as: ```ruby param(:name, String, required: false, default_value: nil) ``` there would be a warning that `default_value` is missing. This fix changes from checking `options[key].blank?` to `options.key?(key)`.
@@ -71,7 +71,7 @@ def for_required | |||
end | |||
|
|||
def for_default | |||
return {} if @param_description.options[:default_value].blank? |
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.
Should we combine this with the allow_nil
and allow_blank
to only allow
default: nil
whenallow_nil: true
anddefault: ""
whenallow_blank: true
?
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.
No, I don't think they should be combined.
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.
LGTM
I'm not really sure about combining it with allow_nil
& allow_blank
🤷♂️
spec/lib/apipie/generator/swagger/param_description/builder_spec.rb
Outdated
Show resolved
Hide resolved
spec/lib/apipie/generator/swagger/param_description/builder_spec.rb
Outdated
Show resolved
Hide resolved
spec/lib/apipie/generator/swagger/param_description/builder_spec.rb
Outdated
Show resolved
Hide resolved
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.
Thanks for the fix
@mathieujobin Could we get a release of this? 🙂 |
sure, sorry for the delay on this. will be in v1.2.3 shortly |
No worries, just a small fix. Thank you 👏🏻 |
When using
param
as:there would be a warning that
default_value
is missing.This fix changes from checking
options[key].blank?
tooptions.key?(key)
.