-
Notifications
You must be signed in to change notification settings - Fork 472
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
Fixed move_params_to_new to allow name to be defined as a Symbol #476
Conversation
Noticed a few other problem cases, fixed in the latest push. Changelog also updated. |
required: true | ||
} | ||
params body_param: { type: 'String', desc: 'param', documentation: { in: 'body' } }, | ||
'body_string_param' => { type: String, desc: 'string_param', documentation: { in: 'body' } } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, this should not be possible, it should be used Ruby >2.x hash style
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, and that is not actually not relevant, the problem was that the type was defined as a constant. Will change the test.
about "one question, could you access the parameter in the post block?" not really sure what you mean but this is what i figured out: |
what I mean is, can the parameter be accessed in the grape post block, here: post do
# can it be accessed?
end |
This definition:
passes the following tests:
|
cool … it seems, one could add parameters via params key, but they would not be added to the declared params array, thanks for clarification |
👍 |
What I am trying to get working is to have the Entity describe the content of the body, and so far with no luck. So with the fixes in this PR and the following definition I almost get what i want:
It would be nice to be able to somehow tell the endpoint that "The body content should be of type X" |
wouldn't it be easier to add |
You are right. Thinking to complicated here, but as long as I'm using the current version I have to manipulate the hash a little to workaround the bugs :) The cleanest solution from swagger point of view would be just to reference a existing model for the body parameter. Now a definition gets generated for every endpoint and model that is defined. |
yeap, fixing the behavior of the params key is on the road map |
…y-grape#476) * Fixed move_params_to_new to allow name to be defined as a Symbol * Fixes for parameter type handling * All param names as symbols
I am trying to use a Entity to describe what is expected inside the request body, while doing this I noticed that when parameters have been defined as body params inside the desc block, grape-swagger causes the app to crash.