Skip to content

Examples in body params #833

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 2 commits into from
Sep 15, 2021
Merged

Examples in body params #833

merged 2 commits into from
Sep 15, 2021

Conversation

stevenou
Copy link
Contributor

When a parameter is in: 'body', it appears to drop the example associated. So it will show:

{
  email: 'string',
  password: 'string'
}

instead of

{
  email: 'example@esp.com',
  password: 'wowthispasswordissosecure!'
}

I took a look at #762 and #821 which purportedly fix the issue, but it still wasn't working for me.

I'm really not familiar with this codebase, but I think the issue is within GrapeSwagger::DocMethods::MoveParams which has a property_keys that appears to limit which properties are retained when creating an "in: body object". I added the example key to that array and it seems to be working.

Would appreciate confirmation whether this is correct fix. Thanks!

@LeFnord
Copy link
Member

LeFnord commented Sep 15, 2021

thanks @stevenou … and sorry for the late reply, please can you add a Changelog entry, thanks

@stevenou
Copy link
Contributor Author

@LeFnord done

@LeFnord LeFnord merged commit 118ecae into ruby-grape:master Sep 15, 2021
aka-momo pushed a commit to aka-momo/grape-swagger that referenced this pull request Feb 8, 2023
* examples in body

* changelog entry
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants