grape icon indicating copy to clipboard operation
grape copied to clipboard

field using types turned into array when declared(params)

Open braktar opened this issue 3 years ago • 11 comments

It seems that the recent works on declared change the interaction between 'declared' and the 'types' field

braktar avatar Oct 05 '20 14:10 braktar

1 Warning
:warning: Unless you’re refactoring existing code, please update CHANGELOG.md.

Here's an example of a CHANGELOG.md entry:

* [#2112](https://github.com/ruby-grape/grape/pull/2112): Field using type turned into array when declared(params) - [@braktar](https://github.com/braktar).

Generated by :no_entry_sign: danger

grape-bot avatar Oct 05 '20 14:10 grape-bot

what was the behavior in 1.3.x, 1.4.x?

either way looks like a bug, another one... /cc: @tlconnor

dblock avatar Oct 05 '20 14:10 dblock

Related https://github.com/ruby-grape/grape/pull/2103

dblock avatar Oct 05 '20 14:10 dblock

Before the integration of #2103 the spec passed successfully

braktar avatar Oct 05 '20 14:10 braktar

Here is a fix which avoid the misinterpretation of the type

braktar avatar Oct 05 '20 15:10 braktar

That's strange that the type of empty_typed_arr turned from Array[String] to [String] when arrived into handle_passed_param

braktar avatar Oct 05 '20 15:10 braktar

Let's extend tests with Hash and Set along with Array?

dblock avatar Oct 05 '20 18:10 dblock

Let's extend tests with Hash and Set along with Array?

I don't really see what should exhibit these tests, as the only ambiguity is between types : [x, y] and type: Array[x, y] which both give type: [x, y] while processed.

It seems to require a deeper investigation

braktar avatar Oct 06 '20 07:10 braktar

Let's extend tests with Hash and Set along with Array?

I don't really see what should exhibit these tests, as the only ambiguity is between types : [x, y] and type: Array[x, y] which both give type: [x, y] while processed.

It seems to require a deeper investigation

I mean what happens if requires :bar, type: Hash do ...?

dblock avatar Oct 06 '20 13:10 dblock

@stanhu isn't this the same?

dblock avatar Oct 09 '20 17:10 dblock

Yes, it's the same. I just picked the commit in https://github.com/ruby-grape/grape/pull/2117.

stanhu avatar Oct 09 '20 21:10 stanhu