diff --git a/CHANGELOG.md b/CHANGELOG.md index 01d89b31..09e66d36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,12 +2,10 @@ #### Features -* Your contribution here. +* [#434](https://github.com/ruby-grape/grape-swagger/pull/434): Add summary to the operation object generator to be more compliant with [OpenAPI v2](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#operation-object) - [@aschuster3](https://github.com/aschuster3). #### Fixes -* Your contribution here. - ### 0.20.4 (May 16, 2016) #### Features diff --git a/README.md b/README.md index 4c357a51..667ea916 100644 --- a/README.md +++ b/README.md @@ -442,6 +442,32 @@ end ``` +#### Overriding the route summary + +By default, the route summary is filled with the value supplied to `desc`. + +```ruby +namespace 'order' do + desc 'This will be your summary' + get :order_id do + ... + end +end +``` + +To override the summary, add `summary: '[string]'` after the description. + +```ruby +namespace 'order' do + desc 'This will be your summary', + summary: 'Now this is your summary!' + get :order_id do + ... + end +end +``` + + #### Expose nested namespace as standalone route Use the `nested: false` property in the `swagger` option to make nested namespaces appear as standalone resources. diff --git a/spec/support/model_parsers/entity_parser.rb b/spec/support/model_parsers/entity_parser.rb index e665f714..ff6a57fb 100644 --- a/spec/support/model_parsers/entity_parser.rb +++ b/spec/support/model_parsers/entity_parser.rb @@ -292,7 +292,6 @@ class RecursiveModel < Grape::Entity 'QueryInput' => { 'type' => 'object', 'properties' => { 'elements' => { 'type' => 'array', 'items' => { '$ref' => '#/definitions/QueryInputElement' }, 'description' => 'Set of configuration' } }, - 'summary' => 'nested route inside namespace', 'description' => 'nested route inside namespace' }, 'QueryInputElement' => { @@ -302,7 +301,6 @@ class RecursiveModel < Grape::Entity 'ApiError' => { 'type' => 'object', 'properties' => { 'code' => { 'type' => 'integer', 'format' => 'int32', 'description' => 'status code' }, 'message' => { 'type' => 'string', 'description' => 'error message' } }, - 'summary' => 'This gets Things.', 'description' => 'This gets Things.' }, 'Something' => { @@ -313,7 +311,6 @@ class RecursiveModel < Grape::Entity 'links' => { 'type' => 'link' }, 'others' => { 'type' => 'text' } }, - 'summary' => 'This gets Things.', 'description' => 'This gets Things.' } } diff --git a/spec/support/model_parsers/representable_parser.rb b/spec/support/model_parsers/representable_parser.rb index 955abc53..2f8be824 100644 --- a/spec/support/model_parsers/representable_parser.rb +++ b/spec/support/model_parsers/representable_parser.rb @@ -361,7 +361,6 @@ class RecursiveModel < Representable::Decorator 'QueryInput' => { 'type' => 'object', 'properties' => { 'elements' => { 'type' => 'array', 'items' => { '$ref' => '#/definitions/QueryInputElement' }, 'description' => 'Set of configuration' } }, - 'summary' => 'nested route inside namespace', 'description' => 'nested route inside namespace' }, 'QueryInputElement' => { @@ -371,7 +370,6 @@ class RecursiveModel < Representable::Decorator 'ApiError' => { 'type' => 'object', 'properties' => { 'code' => { 'type' => 'integer', 'format' => 'int32', 'description' => 'status code' }, 'message' => { 'type' => 'string', 'description' => 'error message' } }, - 'summary' => 'This gets Things.', 'description' => 'This gets Things.' }, 'Something' => { @@ -382,7 +380,6 @@ class RecursiveModel < Representable::Decorator 'links' => { 'type' => 'array', 'items' => { 'description' => '', 'type' => 'link' } }, 'others' => { 'description' => '', 'type' => 'text' } }, - 'summary' => 'This gets Things.', 'description' => 'This gets Things.' } }