-
Notifications
You must be signed in to change notification settings - Fork 459
Request data as json #598
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
Request data as json #598
Conversation
… the 'request_data_json' field.
| :params => @params, | ||
| :query => @query, | ||
| :request_data => @request_data, | ||
| :request_data => request_data, |
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.
Why removing the @ here? Doesn't seem like this could work?
| :query => @query, | ||
| :request_data => @request_data, | ||
| :request_data => request_data, | ||
| :request_data_json => @params, |
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.
How does this differ from :params key?
| sort_by { |ex| ex["show_in_doc"] }. | ||
| map { |ex| format_example(ex.symbolize_keys) } | ||
| map do |ex| | ||
| %w(request_data response_data request_data_json).each do |key| |
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.
Beware of indentation
| examples = Apipie.get_method_description(UsersController, :show).examples | ||
| expect(examples).to all(be_a(Hash)) | ||
| expect(examples.first[:path]).to eq('/users/14') | ||
| expect(examples.second[:path]).to eq('/users/15') |
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.
Mind adding more assertionas about the examples hash to ensure the expected data are there?
|
@iNecas Thanks for taking a look! I'll adjust this once I'm off work :) |
69442b9 to
8215e30
Compare
|
Any updates on it? |
|
Any updates??? |
|
I'm sorry but I don't have access to the fork here since I don't work at the company I originally did this for any longer. I guess you could take the changes made here and open a new fork, based on the current master, but I lack the time (and frankly, the understanding of apipie since I've not been working with it for over 2 years) to continue. |
|
@Haniyya I understand. did you find the replacement for apipie? |
|
@sasharevzin My previous company worked with apipie until the end (more or less). Right now I mainly work on graphql or thrift apis, which makes apipie kind of unnecessary? (I mean there is still value in the way you can document everything and provide examples easily, but the need rarely arises beyond a typed interface). I really enjoyed working with apipie while I did and it was a great way to document a legacy rest api peace by peace so to speak, but in greenfield projects we usually alredy start with some standard like thrift, graphql or OpenApi. |
|
Thank you for your reply. Agree about using Apipie for legacy. Graphql does everything we need 🥳 |
|
reopen if you have time to resolve the conflicts and adjust to today's situation |
This PR changes the appearance of examples and allows for
request_dataof:PUT :PATH :POSTrequests to be displayed as json. Which for a lot of people is easier than the standard query-string.This is part and precursor of #595 which fixes some of the markup.
A few changes are made here:
@paramsattribute of theExtractor::Recordercontains more information about the request and is copied torequest_data_jsonwhen serializing. This field stays untouched until it reaches the template (i didn't useparamshere since it was being modified on deserialization).