Conversation
In case the possible values are dynamic. This probably can't ever be made to work reliably with statically generating HTML documentation. It's expected that the proc never throws an exception.
a07a525 to
df3ecde
Compare
|
When writing this I didn't realize it would become ambiguous when to use |
mathieujobin
left a comment
There was a problem hiding this comment.
if you can increase test coverage and make sure all tests pass. then I can merge and release.
@PanosCodes if you have time to review later, that'd be appreciated as well.
|
|
||
| def self.build(param_description, argument, options, proc) | ||
| self.new(param_description, argument) if argument.is_a?(Array) | ||
| self.new(param_description, argument) if argument.is_a?(Array) || argument.respond_to?(:call) |
There was a problem hiding this comment.
@mathieujobin I'm not sure how to disambiguate this from the ProcValidator here:
apipie-rails/lib/apipie/validator.rb
Line 313 in eeef4de
If you have any thoughts, I'd love to hear them.
I thought about introducing a class that somehow wraps the callable, but it feels rather heavy.
There was a problem hiding this comment.
Because EnumValidator will receive a Proc as well ?
Can you check that is it an Enum before?
.respond_to?(:call) can be a lot of things... so, you accept to build a Enum validator with either an Array or a Proc? not an Enum ? is a Enum a Proc underneath?
it would be good to add a new test where the confusion between the two validator can be demonstrated and the right one is being selected. this will help finding a working implementation.
|
I don't know if it's possible, but since we have a dynamic argument that we want to evaluate at the time apipie is called, can we maybe get the value of the callable before it is given to the validators and have the validator work as is? 🤔 |
In case the possible values are dynamic. This probably can't ever be made to work reliably with statically generating HTML documentation.
It's expected that the proc never throws an exception.
This was triggered by Katello code which really should be dynamic. Rather than using a
ProcValidatorthis gives an accurate description as well.