Apipie / apipie-rails

Ruby on Rails API documentation tool
Apache License 2.0
2.47k stars 459 forks source link

Performance issue #256

Open AlexCppns opened 10 years ago

AlexCppns commented 10 years ago

I noticed that the example methods are being called whenever the api calls are performed. Our examples are doing actual queries in the db which slows down our APIs.. it would be nice to have some control over that.

iNecas commented 10 years ago

Hi, What do you mean by examples doing actual queries to db? Could you give me some example of this usage?

AlexCppns commented 10 years ago

I have examples that look like this:

example JSON.pretty_generate(find_resources_example('plumber'))

I thought the point of using rails to generate the documentation was to use the actual api methods.

iNecas commented 10 years ago

The preferred way is to use the APIPIE_RECORD option to record the examples while running test (either unit, or real world), and then the data are used for showing in the documentation.

The tests don't have to be just unit tests: it should work also with running the rails server with the APIPIE_RECORD=examples and then performing the calls against the rest api: at the end, the examples should record to thd doc/appie_examples.json and should appear in the docs