ruby-grape / ruby-grape/grape-swagger
Using an entity to represent a post body in params
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 1.1k
- Forks
- 479
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 6
Description
Hey there! Thanks so much for all the hard work that goes into grape-swagger and its related projects; they're a huge help.
One thing that I've been running into, and it's something of a cross-cutting concern so I wasn't quite sure whether to put it here or in grape-swagger-entity, is a common problem I'm running into. In other frameworks I've used, you can specify a body's parameter set as an entity or an object. For example, I might have LoginRequest, which specifies username, plaintext, that sort of thing. However, grape-swagger does not make it obvious as to how I would do this and I get a lot of weird error messages (code deep in grape-swagger that gets nils it's not expecting, etc.) when I try to just say "the body parameters for this are just this entity right here".
I know Swagger can describe it, because I've written Swagger documents by hand that do so. I just can't figure out how to make grape-swagger do it, or if the library can at all? Maybe this is totally doable and I'm just goofy, and if so I would love a pointer! But the best I've found is to have a single parameter, conventionally request, and dig into params[:request] for it. Which isn't bad, but the experience of it is kind of weird when I use a client library where I'm passing a named request parameter instead of just username and plaintext. It feels more clunky than the rest of Grape and grape-swagger so I'm wondering either if I'm missing something or if this is as-designed.
Thanks again!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files, tests, or entry points are named. Begin by clarifying whether grape-swagger or grape-swagger-entity should own support for an entity as the request body, then define the expected generated Swagger document and parameter behavior before locating the relevant implementation and tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- api, documentation
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100