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

handle multiple presents #813

Merged
merged 2 commits into from Oct 31, 2020

Conversation

AntoineGst
Copy link
Contributor

Handle the multiple present with swagger.
relates to : #776

Exemple :
You need to pass as parameter, to correctly generate the properties :

desc 'Get multiple presents',
             success: [
               { model: Entities::EnumValues, as: :gender },
               { model: Entities::Something, as: :somethings, is_array: true }
             ]

And this generate the swagger schema like this :

{
   "schema":{
      "type":"object",
      "properties":{
         "gender":{
            "$ref":"#/definitions/EnumValues"
         },
         "somethings":{
            "type":"array",
            "items":{
               "$ref":"#/definitions/Something"
            }
         }
      }
   }
}

@coveralls
Copy link

coveralls commented Oct 23, 2020

Coverage Status

Coverage increased (+0.009%) to 99.585% when pulling 9916bb2 on AntoineGuestin:feat_multiple_presents into 8d245e5 on ruby-grape:master.

@LeFnord
Copy link
Member

LeFnord commented Oct 27, 2020

thanks @AntoineGuestin … this is a very welcome PR,
but please can you add a section in the README, similar to your description here, thanks again 😄

@AntoineGst
Copy link
Contributor Author

Hi @LeFnord,
I add a section in the README ;)

@LeFnord
Copy link
Member

LeFnord commented Oct 31, 2020

👍 … thanks

@LeFnord LeFnord merged commit 08ae87f into ruby-grape:master Oct 31, 2020
@AntoineGst AntoineGst deleted the feat_multiple_presents branch November 2, 2020 08:30
aka-momo pushed a commit to aka-momo/grape-swagger that referenced this pull request Feb 8, 2023
* handle multiple presents

* update documentation and changelog
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.

None yet

3 participants