From 63414d85c0a0e7608bcfaa91ccb717c822b9c202 Mon Sep 17 00:00:00 2001 From: Colin Ross Date: Thu, 2 Nov 2017 08:16:02 -0700 Subject: [PATCH] Allow for resource-level deprecations Resources can now be marked as deprecated. This marking is also referenced at the method level, meaning that resources marked as deprecated will have all their methods marked as such as well. This commit also includes related updates to the views used for generating documentation --- README.rst | 4 ++++ app/views/apipie/apipies/index.html.erb | 6 +++++- app/views/apipie/apipies/resource.html.erb | 3 +++ lib/apipie/dsl_definition.rb | 8 +++++++- lib/apipie/method_description.rb | 2 +- lib/apipie/resource_description.rb | 7 +++++-- spec/lib/method_description_spec.rb | 7 +++++++ 7 files changed, 32 insertions(+), 5 deletions(-) diff --git a/README.rst b/README.rst index aad752cc..ea838d36 100644 --- a/README.rst +++ b/README.rst @@ -136,6 +136,9 @@ app_info meta Hash or array with custom metadata. +deprecated + Boolean value indicating if the resource is marked as deprecated. (Default false) + Example: ~~~~~~~~ @@ -154,6 +157,7 @@ Example: error 500, "Server crashed for some <%= reason %>", :meta => {:anything => "you can think of"} error :unprocessable_entity, "Could not save the entity." meta :author => {:name => 'John', :surname => 'Doe'} + deprecated false description <<-EOS == Long description Example resource for rest api documentation diff --git a/app/views/apipie/apipies/index.html.erb b/app/views/apipie/apipies/index.html.erb index 5f29bf2c..76a4fa2d 100644 --- a/app/views/apipie/apipies/index.html.erb +++ b/app/views/apipie/apipies/index.html.erb @@ -16,7 +16,11 @@

<%= api[:name] %> -
+ + <% if api[:deprecated] %> + DEPRECATED + <% end %> +
<%= api[:short_description] %>

diff --git a/app/views/apipie/apipies/resource.html.erb b/app/views/apipie/apipies/resource.html.erb index 11fbff72..ffd91274 100644 --- a/app/views/apipie/apipies/resource.html.erb +++ b/app/views/apipie/apipies/resource.html.erb @@ -13,6 +13,9 @@