mavenlink / brainstem

The Brainstem gem provides a framework for converting ActiveRecord objects into a great JSON API. Brainstem Presenters allow easy application of user-requested sorts, filters, and association loads, allowing for simpler implementations, fewer requests, and smaller responses.
MIT License
202 stars 14 forks source link

OpenAPI documentation DSL improvements #133

Open shirish-pampoorickal opened 5 years ago

shirish-pampoorickal commented 5 years ago

Please add any concerns, enhancements, bugs with the DSL for API documentation

guanw88 commented 5 years ago

Enhancement Requests: 1) Allow the ability to customize text on a path parameter.

We can customize query params as follows, but there is no way to customize a path param.

valid :varname, :integer,
              required: true,
              info: "foo bar"

2) Allow the ability to add/customize different response codes.

We can add a response as below, but there is no way to specify the error code and the associated text.

response :hash do |response_fields|
              response_fields.field :title, :string, info: "title of the object"

              response_fields.fields :categories, :array, item_type: :hash do |category|
                category.field :name, :string, info: "the name of the assoccategory"
              end

              response_fields.fields :parent, :hash do |parent|
                parent.field :title, :string, info: "title of the parent"
              end
            end
shirish-pampoorickal commented 4 years ago

Enhancement: Only document presenters that are referenced in a documented controller

kcotugno commented 4 years ago

Currently search documentation cannot be customized. It would be great if we can!