Apipie / apipie-rails

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

overriding controllers & custom variables #297

Open anidhya opened 9 years ago

anidhya commented 9 years ago

Hi, I have a couple of pages which I wanna integrate along with the default resource pages. I was thinking of overwriting apipie controller and to allow serving static pages. Do you think it is a good idea? Also I need a few custom variables, and I dont find any documentation on that. Is it possible to create extra custom variable to use it in the views?

Btw thank you so much for the wonderful gem.

saneshark commented 9 years ago

:+1: for custom variables, or overriding names of existing ones.

For example, I would like to use param to characterize JSON payload for PUT/POST/PATCH to more granularly define type for the attributes provided in the JSON body. Naturally one could just use param for these, but it's not always obvious which is a formurlencoded query parameter and what is the JSON payload when you have both.

I could also see the need for documenting things such as Etags and Caching, and authentication params required for all requests being a part of a General API section vs param_group included for each endpoint (as that just muddles things up otherwise).

It would also be very nice if the generated examples could accept title, api_method, etc such that the generated examples JSON could reference the specific endpoint. This is useful when you have routes that set a default type but hit the same action in the same controller. Rather than having the examples listed underneath each api, they would only appear when the specific api endpoint is hit.