Skip to content

Conversation

@Haniyya
Copy link
Contributor

@Haniyya Haniyya commented Jan 17, 2018

This PR changes the appearance of examples and allows for request_data of :PUT :PATH :POST requests 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:

  1. Examples are no longer pre-formated when passed to the template. Instead the normal case will be to have Hash-examples that have their own partial and a seperate one for simple String examples.
  2. The @params attribute of the Extractor::Recorder contains more information about the request and is copied to request_data_json when serializing. This field stays untouched until it reaches the template (i didn't use params here since it was being modified on deserialization).
  3. The included Bootstrap was updated to 3.3.7.
  4. There is (incomplete and not working, fixed in Better example display #595) markup for method display.

:params => @params,
:query => @query,
:request_data => @request_data,
:request_data => request_data,
Copy link
Member

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,
Copy link
Member

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|
Copy link
Member

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')
Copy link
Member

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?

@Haniyya
Copy link
Contributor Author

Haniyya commented Apr 27, 2018

@iNecas Thanks for taking a look! I'll adjust this once I'm off work :)

@ofedoren ofedoren force-pushed the master branch 2 times, most recently from 69442b9 to 8215e30 Compare July 25, 2021 19:41
@sasharevzin
Copy link

Any updates on it?

@sharkey11
Copy link

Any updates???

@Haniyya
Copy link
Contributor Author

Haniyya commented Feb 14, 2022

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 Haniyya closed this Feb 14, 2022
@sasharevzin
Copy link

@Haniyya I understand. did you find the replacement for apipie?

@Haniyya
Copy link
Contributor Author

Haniyya commented Feb 14, 2022

@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.
And thank you for understanding. I really do feel bad leaving this feature as it seems close to being done, but I can't get my head around it anymore.

@sasharevzin
Copy link

Thank you for your reply. Agree about using Apipie for legacy. Graphql does everything we need 🥳

@mathieujobin mathieujobin reopened this Jan 3, 2023
@mathieujobin mathieujobin added the Stale waiting for update label Jul 13, 2023
@mathieujobin
Copy link
Collaborator

reopen if you have time to resolve the conflicts and adjust to today's situation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Stale waiting for update

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants