Skip to content
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

Empty field for group parameters' name with type hash or Array #91

Closed
salimane opened this issue Mar 6, 2014 · 17 comments
Closed

Empty field for group parameters' name with type hash or Array #91

salimane opened this issue Mar 6, 2014 · 17 comments

Comments

@salimane
Copy link

salimane commented Mar 6, 2014

Take the following example:

params do
  optional :preferences, type: Array do
    requires :key
    requires :value
  end

  requires :name, type: Hash do
    requires :first_name
    requires :last_name
  end
end

In swagger-ui, there would be an empty text field for preferences and name. Is this suppoed to be this way ? Tested using the github version of grape and grape-swagger.

Thanks

@klausmeyer
Copy link

👍 had the same problem yesterday. It only occurs when I'm using grape master from github. On the official gem version 0.6.1 everything is fine.

@jhonathas
Copy link

On last version no worker?

@davetapley
Copy link
Contributor

Same here 👋

This?

selection_167

@klausmeyer
Copy link

Yes this is the problem I had.

@DavidValin
Copy link

I'm using the gem now to build my api and I see the same. Using grape-swagger (0.7.2) and grape-swagger-ui (0.0.4) and grape (0.7.0) :-(

@dblock
Copy link
Member

dblock commented Jul 14, 2014

Can someone please retest this against Grape 0.8.0 and maybe add specs around the issue here?

@dblock dblock added bug? and removed needs help labels Jul 14, 2014
@davetapley
Copy link
Contributor

@dblock coming right up.

davetapley added a commit to davetapley/grape-swagger that referenced this issue Jul 14, 2014
davetapley added a commit to davetapley/grape-swagger that referenced this issue Jul 14, 2014
davetapley added a commit to davetapley/grape-swagger that referenced this issue Jul 15, 2014
@davetapley
Copy link
Contributor

I've tracked this back to a change in grape between 0.6.0 and 0.8.0.
Awaiting to see if it's a regression there, or an expected change in behavior, see here.

@davetapley
Copy link
Contributor

Okay, I've got a good conversation going with @dblock on that thread, where we've established that it was a regression (at least in the sense that the behavior change isn't fully understood / documented).

We'll figure it out there.

@syntaxTerr0r
Copy link

Hi there ! Any news on this ?

@dblock
Copy link
Member

dblock commented Aug 25, 2014

@davetapley
Copy link
Contributor

Uh oh, since #47 got fixed (specifically since 04566fc went in), this is even more hilariously wrong.

To demonstrate it, I extended the test API with the relevant part of the specs, and ran it through http://petstore.swagger.wordnik.com/ to demonstrate:

selection_006

Note that the 'empty field' is now a file selector 😆
I'd like to suggest that the fault lays with the implementation of the #47 fix, so I'll bring it up there too.

@davetapley davetapley mentioned this issue Sep 12, 2014
@dblock
Copy link
Member

dblock commented Sep 13, 2014

@dukedave Indeed. Care to PR some specs to start?

davetapley added a commit to davetapley/grape-swagger that referenced this issue Sep 19, 2014
davetapley added a commit to davetapley/grape-swagger that referenced this issue Sep 19, 2014
@davetapley
Copy link
Contributor

@dblock okay, so 791943c demonstrates the problem shown in the image above.

Since the new file selector problem is only visible as a result of this issue, I just fixed this issue solely in 47168a4. For reference the spec to cover this fix went in on c18719f.

It's not the prettiest solution, but I don't see that grape is going to stop sending us these 'parent of a nested param' params any time soon (since it doesn't break anything in grape).

@dblock
Copy link
Member

dblock commented Oct 21, 2014

Fixed in tim-vandecasteele@15604b0.

@nono
Copy link

nono commented Oct 28, 2014

It's not really fixed. It doesn't work for the first example:

  optional :preferences, type: Array do
    requires :key
    requires :value
  end

Swagger-ui uses this to generate preferences[key]=foo&preferences[value]=bar, as if preferences was an hash and not array.

@dblock
Copy link
Member

dblock commented Oct 29, 2014

@nono, can you please reopen a bug, hopefully with a failing spec? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants