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

Change output to be compatible with swagger-ui #105

Merged
merged 25 commits into from
Jul 11, 2014
Merged

Change output to be compatible with swagger-ui #105

merged 25 commits into from
Jul 11, 2014

Conversation

krisalyssa
Copy link
Contributor

I tried to keep the output backward compatible. If I broke something, please let me know.

@kylejginavan
Copy link

These changes were implemented to support this PR swagger-api/swagger-ui#398 which will soon be moved to master. This PR will truly make swagger very useful for Railers, more specifically, will make it so nested attributes is more how Railers use them.

@krisalyssa
Copy link
Contributor Author

Ugh. I just discovered that in the process of collecting commits for this PR some code got left out. I'll fix it and add more commits.

@krisalyssa
Copy link
Contributor Author

Note that this PR now contains at least most of #104.

@krisalyssa
Copy link
Contributor Author

A lot of these changes were driven by looking at the JSON produced by the sample code for swagger-api/swagger-ui#398 and making the JSON produced by grape-swagger as similar as possible.

New values in operations:

  • consumes - currently hardcoded to "application/json"
  • method - set to the same value as httpMethod
  • type - currently hardcoded to "void"

New values in params:

  • allowMultiple - true if the param is backed by the :is_array option, false otherwise.

Additionally, dataType is set to array and items is set correctly if the param is backed by an array.

Finally, for POST, PUT, and PATCH methods, if the param has a data type beginning with Entity or Entities, paramType will be set to body.

@fehguy
Copy link

fehguy commented May 12, 2014

+1

@fehguy
Copy link

fehguy commented May 31, 2014

@tim-vandecasteele I've verified that these changes are producing valid swagger-json! There's a full sample project here. Would be great to get this merged back to your gem!

renier pushed a commit to renier/grape-swagger that referenced this pull request Jun 6, 2014
This is on top of pull request ruby-grape#105.

Conflicts:
	lib/grape-swagger.rb
@erkattak
Copy link

This would be super helpful 👍

krisalyssa added a commit that referenced this pull request Jul 11, 2014
Change output to be compatible with swagger-ui
@krisalyssa krisalyssa merged commit 2a07023 into ruby-grape:master Jul 11, 2014
@antek-drzewiecki antek-drzewiecki mentioned this pull request Jul 31, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants