grape-swagger 0.27.0 → 0.27.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +3 -3
- data/CHANGELOG.md +7 -5
- data/Gemfile +1 -1
- data/README.md +108 -95
- data/Rakefile +1 -1
- data/lib/grape-swagger/doc_methods.rb +2 -1
- data/lib/grape-swagger/doc_methods/data_type.rb +13 -13
- data/lib/grape-swagger/doc_methods/move_params.rb +1 -1
- data/lib/grape-swagger/doc_methods/parse_params.rb +1 -1
- data/lib/grape-swagger/endpoint.rb +4 -3
- data/lib/grape-swagger/version.rb +1 -1
- data/spec/issues/537_enum_values_spec.rb +4 -4
- data/spec/issues/572_array_post_body_spec.rb +1 -1
- data/spec/lib/endpoint_spec.rb +1 -1
- data/spec/lib/parse_params_spec.rb +4 -4
- data/spec/lib/tag_name_description_spec.rb +2 -2
- data/spec/lib/version_spec.rb +3 -3
- data/spec/support/model_parsers/entity_parser.rb +4 -4
- data/spec/support/model_parsers/mock_parser.rb +2 -2
- data/spec/support/model_parsers/representable_parser.rb +4 -4
- data/spec/swagger_v2/api_swagger_v2_global_configuration_spec.rb +3 -1
- data/spec/swagger_v2/api_swagger_v2_param_type_body_nested_spec.rb +3 -3
- data/spec/swagger_v2/form_params_spec.rb +3 -3
- data/spec/swagger_v2/namespace_tags_prefix_spec.rb +1 -1
- data/spec/swagger_v2/param_multi_type_spec.rb +1 -1
- data/spec/swagger_v2/param_type_spec.rb +1 -1
- data/spec/swagger_v2/param_values_spec.rb +4 -4
- data/spec/swagger_v2/params_array_spec.rb +1 -1
- metadata +3 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 3d4da1b29c0c251744171e78d2d8e7f9911c8b0d
         | 
| 4 | 
            +
              data.tar.gz: 24c02ffce502d8e7379fbde275c9f747f3bc07d3
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: cf0dadce63c9f23539eab02f871cbaeeccc6a39af8ca7b2e588fe3082301eed7e913ab2e77d1cbcfb7b90f56f645bad348fa5248b609677ab5a436df4026f633
         | 
| 7 | 
            +
              data.tar.gz: 6b094b917156606be769a220c74a06198b0721e54e2a456b8104baad7c1605ec1e2642d01f308778cb260e4ab7dd7313be8d913b0eef7225d32c7b2fd0f62d09
         | 
    
        data/.travis.yml
    CHANGED
    
    | @@ -11,7 +11,7 @@ after_success: | |
| 11 11 |  | 
| 12 12 | 
             
            rvm:
         | 
| 13 13 | 
             
              - 2.4.1
         | 
| 14 | 
            -
              - 2.3. | 
| 14 | 
            +
              - 2.3.4
         | 
| 15 15 |  | 
| 16 16 | 
             
            env:
         | 
| 17 17 | 
             
              - MODEL_PARSER=grape-swagger-entity
         | 
| @@ -19,14 +19,14 @@ env: | |
| 19 19 | 
             
              - GRAPE_VERSION=0.16.2
         | 
| 20 20 | 
             
              - GRAPE_VERSION=0.17.0
         | 
| 21 21 | 
             
              - GRAPE_VERSION=0.18.0
         | 
| 22 | 
            -
              - GRAPE_VERSION=0.19. | 
| 22 | 
            +
              - GRAPE_VERSION=0.19.2
         | 
| 23 23 | 
             
              - GRAPE_VERSION=HEAD
         | 
| 24 24 |  | 
| 25 25 | 
             
            matrix:
         | 
| 26 26 | 
             
              fast_finish: true
         | 
| 27 27 |  | 
| 28 28 | 
             
              include:
         | 
| 29 | 
            -
                - rvm: 2.2. | 
| 29 | 
            +
                - rvm: 2.2.7
         | 
| 30 30 | 
             
                  env:
         | 
| 31 31 | 
             
                - rvm: ruby-head
         | 
| 32 32 | 
             
                  env:
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -8,7 +8,13 @@ | |
| 8 8 |  | 
| 9 9 | 
             
            * Your contribution here.
         | 
| 10 10 |  | 
| 11 | 
            -
            ###  0.27. | 
| 11 | 
            +
            ### ###  0.27.1 (April 28, 2017)
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            #### Features
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            * [#602](https://github.com/ruby-grape/grape-swagger/pull/602): Allow security object to be defined - [@markevich](https://github.com/markevich).
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            ###  0.27.0 (March 27, 2017)
         | 
| 12 18 |  | 
| 13 19 | 
             
            #### Features
         | 
| 14 20 |  | 
| @@ -16,8 +22,6 @@ | |
| 16 22 | 
             
            * [#588](https://github.com/ruby-grape/grape-swagger/pull/588): Allow extension keys in Info object - [@mattyr](https://github.com/mattyr).
         | 
| 17 23 | 
             
            * [#589](https://github.com/ruby-grape/grape-swagger/pull/589): Allow overriding tag definitions in Info object - [@mattyr](https://github.com/mattyr).
         | 
| 18 24 |  | 
| 19 | 
            -
            * Your contribution here.
         | 
| 20 | 
            -
             | 
| 21 25 | 
             
            #### Fixes
         | 
| 22 26 |  | 
| 23 27 | 
             
            * [#580](https://github.com/ruby-grape/grape-swagger/pull/580): Issue #578: fixes duplicated path params - [@LeFnord](https://github.com/LeFnord).
         | 
| @@ -25,8 +29,6 @@ | |
| 25 29 | 
             
            * [#586](https://github.com/ruby-grape/grape-swagger/pull/586): Issue #587: Parameters delimited by dash cause exception - [@risa](https://github.com/risa).
         | 
| 26 30 | 
             
            * [#593](https://github.com/ruby-grape/grape-swagger/pull/593): Clarify hidden option in readme - [@thogg4](https://github.com/thogg4).
         | 
| 27 31 |  | 
| 28 | 
            -
            * Your contribution here.
         | 
| 29 | 
            -
             | 
| 30 32 | 
             
            ### 0.26.1 (February 3, 2017)
         | 
| 31 33 |  | 
| 32 34 | 
             
            #### Features
         | 
    
        data/Gemfile
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -21,8 +21,8 @@ | |
| 21 21 | 
             
            * [Example](#example)
         | 
| 22 22 | 
             
            * [Rake Tasks](#rake)
         | 
| 23 23 |  | 
| 24 | 
            -
             | 
| 25 | 
            -
            ## What is grape-swagger?
         | 
| 24 | 
            +
             | 
| 25 | 
            +
            ## What is grape-swagger? <a name="what" />
         | 
| 26 26 |  | 
| 27 27 | 
             
            The grape-swagger gem provides an autogenerated documentation for your [Grape](https://github.com/ruby-grape/grape) API. The generated documentation is Swagger-compliant, meaning it can easily be discovered in [Swagger UI](https://github.com/wordnik/swagger-ui). You should be able to point [the petstore demo](http://petstore.swagger.io/) to your API.
         | 
| 28 28 |  | 
| @@ -30,8 +30,8 @@ The grape-swagger gem provides an autogenerated documentation for your [Grape](h | |
| 30 30 |  | 
| 31 31 | 
             
            This screenshot is based on the [Hussars](https://github.com/LeFnord/hussars) sample app.
         | 
| 32 32 |  | 
| 33 | 
            -
             | 
| 34 | 
            -
            ## Related Projects
         | 
| 33 | 
            +
             | 
| 34 | 
            +
            ## Related Projects <a name="related" />
         | 
| 35 35 |  | 
| 36 36 | 
             
            * [Grape](https://github.com/ruby-grape/grape)
         | 
| 37 37 | 
             
            * [Grape Swagger Entity](https://github.com/ruby-grape/grape-swagger-entity)
         | 
| @@ -40,8 +40,8 @@ This screenshot is based on the [Hussars](https://github.com/LeFnord/hussars) sa | |
| 40 40 | 
             
            * [Swagger UI](https://github.com/wordnik/swagger-ui)
         | 
| 41 41 |  | 
| 42 42 |  | 
| 43 | 
            -
             | 
| 44 | 
            -
            ## Compatibility
         | 
| 43 | 
            +
             | 
| 44 | 
            +
            ## Compatibility <a name="version" />
         | 
| 45 45 |  | 
| 46 46 | 
             
            The following versions of grape, grape-entity and grape-swagger can currently be used together.
         | 
| 47 47 |  | 
| @@ -53,15 +53,15 @@ grape-swagger | swagger spec | grape                   | grape-entity | represen | |
| 53 53 | 
             
            0.26.0        |     2.0      | >= 0.16.2               | <= 0.6.1     | >= 2.4.1      |
         | 
| 54 54 | 
             
            0.27.0        |     2.0      | >= 0.16.2               | => 0.5.0     | >= 2.4.1      |
         | 
| 55 55 |  | 
| 56 | 
            -
             | 
| 57 | 
            -
            ## Swagger-Spec
         | 
| 56 | 
            +
             | 
| 57 | 
            +
            ## Swagger-Spec <a name="swagger-spec" />
         | 
| 58 58 |  | 
| 59 59 | 
             
            Grape-swagger generates documentation per [Swagger / OpenAPI Spec 2.0](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md).
         | 
| 60 60 |  | 
| 61 61 | 
             
            <!-- validating it with: http://bigstickcarpet.com/swagger-parser/www/index.html -->
         | 
| 62 62 |  | 
| 63 | 
            -
             | 
| 64 | 
            -
            ## Installation
         | 
| 63 | 
            +
             | 
| 64 | 
            +
            ## Installation <a name="install" />
         | 
| 65 65 |  | 
| 66 66 | 
             
            Add to your Gemfile:
         | 
| 67 67 |  | 
| @@ -74,8 +74,8 @@ gem 'grape-swagger' | |
| 74 74 | 
             
            Please see [UPGRADING](UPGRADING.md) when upgrading from a previous version.
         | 
| 75 75 |  | 
| 76 76 |  | 
| 77 | 
            -
             | 
| 78 | 
            -
            ## Usage
         | 
| 77 | 
            +
             | 
| 78 | 
            +
            ## Usage <a name="usage" />
         | 
| 79 79 |  | 
| 80 80 | 
             
            Mount all your different APIs (with ```Grape::API``` superclass) on a root node. In the root class definition, include ```add_swagger_documentation```, this sets up the system and registers the documentation on '/swagger_doc'. See [example/config.ru](example/config.ru) for a simple demo.
         | 
| 81 81 |  | 
| @@ -97,8 +97,8 @@ end | |
| 97 97 | 
             
            To explore your API, either download [Swagger UI](https://github.com/wordnik/swagger-ui) and set it up yourself or go to the [online swagger demo](http://petstore.swagger.wordnik.com/) and enter your localhost url documentation root in the url field (probably something in the line of http://localhost:3000/swagger_doc).
         | 
| 98 98 |  | 
| 99 99 |  | 
| 100 | 
            -
             | 
| 101 | 
            -
            ## Model Parsers
         | 
| 100 | 
            +
             | 
| 101 | 
            +
            ## Model Parsers <a name="model_parsers" />
         | 
| 102 102 |  | 
| 103 103 | 
             
            Since 0.21.0, `Grape::Entity` is not a part of grape-swagger, you need to add `grape-swagger-entity` manually to your Gemfile.
         | 
| 104 104 | 
             
            Also added support for [representable](https://github.com/apotonick/representable) via `grape-swagger-representable`.
         | 
| @@ -116,7 +116,7 @@ If you are not using Rails, make sure to load the parser inside your application | |
| 116 116 |  | 
| 117 117 | 
             
            You can create your own model parser, for example for [roar](https://github.com/apotonick/roar).
         | 
| 118 118 |  | 
| 119 | 
            -
            ``` | 
| 119 | 
            +
            ```ruby
         | 
| 120 120 | 
             
            module GrapeSwagger
         | 
| 121 121 | 
             
              module Roar
         | 
| 122 122 | 
             
                class Parser
         | 
| @@ -138,7 +138,7 @@ end | |
| 138 138 |  | 
| 139 139 | 
             
            Then you should register your custom parser.
         | 
| 140 140 |  | 
| 141 | 
            -
            ``` | 
| 141 | 
            +
            ```ruby
         | 
| 142 142 | 
             
            GrapeSwagger.model_parsers.register(GrapeSwagger::Roar::Parser, Roar::Decorator)
         | 
| 143 143 | 
             
            ```
         | 
| 144 144 |  | 
| @@ -146,13 +146,13 @@ To control model parsers sequence, you can insert your parser before or after an | |
| 146 146 |  | 
| 147 147 | 
             
            #### insert_before
         | 
| 148 148 |  | 
| 149 | 
            -
            ``` | 
| 149 | 
            +
            ```ruby
         | 
| 150 150 | 
             
            GrapeSwagger.model_parsers.insert_before(GrapeSwagger::Representable::Parser, GrapeSwagger::Roar::Parser, Roar::Decorator)
         | 
| 151 151 | 
             
            ```
         | 
| 152 152 |  | 
| 153 153 | 
             
            #### insert_after
         | 
| 154 154 |  | 
| 155 | 
            -
            ``` | 
| 155 | 
            +
            ```ruby
         | 
| 156 156 | 
             
            GrapeSwagger.model_parsers.insert_after(GrapeSwagger::Roar::Parser, GrapeSwagger::Representable::Parser, Representable::Decorator)
         | 
| 157 157 | 
             
            ```
         | 
| 158 158 |  | 
| @@ -163,7 +163,7 @@ As we know, `Roar::Decorator` uses `Representable::Decorator` as a superclass, t | |
| 163 163 |  | 
| 164 164 | 
             
            If you use the online demo, make sure your API supports foreign requests by enabling CORS in Grape, otherwise you'll see the API description, but requests on the API won't return. Use [rack-cors](https://github.com/cyu/rack-cors) to enable CORS.
         | 
| 165 165 |  | 
| 166 | 
            -
             | 
| 166 | 
            +
            ```ruby
         | 
| 167 167 | 
             
            require 'rack/cors'
         | 
| 168 168 | 
             
            use Rack::Cors do
         | 
| 169 169 | 
             
              allow do
         | 
| @@ -183,8 +183,8 @@ end | |
| 183 183 | 
             
            ```
         | 
| 184 184 |  | 
| 185 185 |  | 
| 186 | 
            -
             | 
| 187 | 
            -
            ## Configure
         | 
| 186 | 
            +
             | 
| 187 | 
            +
            ## Configure <a name="configure" />
         | 
| 188 188 |  | 
| 189 189 | 
             
            * [host](#host)
         | 
| 190 190 | 
             
            * [base_path](#base_path)
         | 
| @@ -196,6 +196,7 @@ end | |
| 196 196 | 
             
            * [swagger_endpoint_guard](#swagger_endpoint_guard)
         | 
| 197 197 | 
             
            * [token_owner](#token_owner)
         | 
| 198 198 | 
             
            * [security_definitions](#security_definitions)
         | 
| 199 | 
            +
            * [security](#security)
         | 
| 199 200 | 
             
            * [models](#models)
         | 
| 200 201 | 
             
            * [tags](#tags)
         | 
| 201 202 | 
             
            * [hide_documentation_path](#hide_documentation_path)
         | 
| @@ -213,16 +214,16 @@ add_swagger_documentation \ | |
| 213 214 | 
             
              base_path: proc { |request| request.host =~ /^example/ ? '/api-example' : '/api' }
         | 
| 214 215 | 
             
            ```
         | 
| 215 216 |  | 
| 216 | 
            -
             | 
| 217 | 
            -
            #### host:
         | 
| 217 | 
            +
             | 
| 218 | 
            +
            #### host: <a name="host" />
         | 
| 218 219 | 
             
            Sets explicit the `host`, default would be taken from `request`.
         | 
| 219 220 | 
             
            ```ruby
         | 
| 220 221 | 
             
            add_swagger_documentation \
         | 
| 221 222 | 
             
               host: 'www.example.com'
         | 
| 222 223 | 
             
            ```
         | 
| 223 224 |  | 
| 224 | 
            -
             | 
| 225 | 
            -
            #### base_path:
         | 
| 225 | 
            +
             | 
| 226 | 
            +
            #### base_path: <a name="base_path" />
         | 
| 226 227 | 
             
            Base path of the API that's being exposed, default would be taken from `request`.
         | 
| 227 228 | 
             
            ```ruby
         | 
| 228 229 | 
             
            add_swagger_documentation \
         | 
| @@ -231,8 +232,8 @@ add_swagger_documentation \ | |
| 231 232 |  | 
| 232 233 | 
             
            `host` and `base_path` are also accepting a `proc` or `lambda`
         | 
| 233 234 |  | 
| 234 | 
            -
             | 
| 235 | 
            -
            #### mount_path:
         | 
| 235 | 
            +
             | 
| 236 | 
            +
            #### mount_path: <a name="mount_path" />
         | 
| 236 237 | 
             
            The path where the API documentation is loaded, default is: `/swagger_doc`.
         | 
| 237 238 | 
             
            ```ruby
         | 
| 238 239 | 
             
            add_swagger_documentation \
         | 
| @@ -255,20 +256,20 @@ add_swagger_documentation \ | |
| 255 256 | 
             
               add_version: true
         | 
| 256 257 | 
             
            ```
         | 
| 257 258 |  | 
| 258 | 
            -
             | 
| 259 | 
            -
            #### doc_version:
         | 
| 259 | 
            +
             | 
| 260 | 
            +
            #### doc_version: <a name="doc_version" />
         | 
| 260 261 | 
             
            Specify the version of the documentation at [info section](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#info-object), default is: `'0.0.1'`
         | 
| 261 262 | 
             
            ```ruby
         | 
| 262 263 | 
             
            add_swagger_documentation \
         | 
| 263 264 | 
             
               doc_version: '0.0.1'
         | 
| 264 265 | 
             
            ```
         | 
| 265 266 |  | 
| 266 | 
            -
             | 
| 267 | 
            -
            #### markdown: (deprecated)
         | 
| 267 | 
            +
             | 
| 268 | 
            +
            #### markdown: (deprecated) <a name="markdown" />
         | 
| 268 269 | 
             
            OAPI accepts GFM for descriptions
         | 
| 269 270 |  | 
| 270 | 
            -
             | 
| 271 | 
            -
            #### endpoint_auth_wrapper:
         | 
| 271 | 
            +
             | 
| 272 | 
            +
            #### endpoint_auth_wrapper: <a name="endpoint_auth_wrapper" />
         | 
| 272 273 | 
             
            Specify the middleware to use for securing endpoints.
         | 
| 273 274 |  | 
| 274 275 | 
             
            ```ruby
         | 
| @@ -276,8 +277,8 @@ add_swagger_documentation \ | |
| 276 277 | 
             
               endpoint_auth_wrapper: WineBouncer::OAuth2
         | 
| 277 278 | 
             
            ```
         | 
| 278 279 |  | 
| 279 | 
            -
             | 
| 280 | 
            -
            #### swagger_endpoint_guard:
         | 
| 280 | 
            +
             | 
| 281 | 
            +
            #### swagger_endpoint_guard: <a name="swagger_endpoint_guard" />
         | 
| 281 282 | 
             
            Specify the method and auth scopes, used by the middleware for securing endpoints.
         | 
| 282 283 |  | 
| 283 284 | 
             
            ```ruby
         | 
| @@ -285,8 +286,8 @@ add_swagger_documentation \ | |
| 285 286 | 
             
               swagger_endpoint_guard: 'oauth2 false'
         | 
| 286 287 | 
             
            ```
         | 
| 287 288 |  | 
| 288 | 
            -
             | 
| 289 | 
            -
            #### token_owner:
         | 
| 289 | 
            +
             | 
| 290 | 
            +
            #### token_owner: <a name="token_owner" />
         | 
| 290 291 | 
             
            Specify the token_owner method, provided by the middleware, which is typically named 'resource_owner'.
         | 
| 291 292 |  | 
| 292 293 | 
             
            ```ruby
         | 
| @@ -294,8 +295,8 @@ add_swagger_documentation \ | |
| 294 295 | 
             
               token_owner: 'resource_owner'
         | 
| 295 296 | 
             
            ```
         | 
| 296 297 |  | 
| 297 | 
            -
             | 
| 298 | 
            -
            #### security_definitions:
         | 
| 298 | 
            +
             | 
| 299 | 
            +
            #### security_definitions: <a name="security_definitions" />
         | 
| 299 300 | 
             
            Specify the [Security Definitions Object](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#security-definitions-object)
         | 
| 300 301 |  | 
| 301 302 | 
             
            _NOTE: [Swagger-UI is supporting only implicit flow yet](https://github.com/swagger-api/swagger-ui/issues/2406#issuecomment-248651879)_
         | 
| @@ -311,8 +312,20 @@ add_swagger_documentation \ | |
| 311 312 | 
             
              }
         | 
| 312 313 | 
             
            ```
         | 
| 313 314 |  | 
| 314 | 
            -
            <a name=" | 
| 315 | 
            -
             | 
| 315 | 
            +
            #### security: <a name="security" />
         | 
| 316 | 
            +
            Specify the [Security Object](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#securityRequirementObject)
         | 
| 317 | 
            +
             | 
| 318 | 
            +
            ```ruby
         | 
| 319 | 
            +
            add_swagger_documentation \
         | 
| 320 | 
            +
              security: [
         | 
| 321 | 
            +
                {
         | 
| 322 | 
            +
                  api_key: []
         | 
| 323 | 
            +
                }
         | 
| 324 | 
            +
              ]
         | 
| 325 | 
            +
            ```
         | 
| 326 | 
            +
             | 
| 327 | 
            +
             | 
| 328 | 
            +
            #### models: <a name="models" />
         | 
| 316 329 | 
             
            A list of entities to document. Combine with the [grape-entity](https://github.com/ruby-grape/grape-entity) gem.
         | 
| 317 330 |  | 
| 318 331 | 
             
            These would be added to the definitions section of the swagger file.
         | 
| @@ -325,8 +338,8 @@ add_swagger_documentation \ | |
| 325 338 | 
             
               ]
         | 
| 326 339 | 
             
            ```
         | 
| 327 340 |  | 
| 328 | 
            -
             | 
| 329 | 
            -
            ### tags:
         | 
| 341 | 
            +
             | 
| 342 | 
            +
            ### tags: <a name="tags" />
         | 
| 330 343 | 
             
            A list of tags to document.  By default tags are automatically generated
         | 
| 331 344 | 
             
            for endpoints based on route names.
         | 
| 332 345 |  | 
| @@ -337,8 +350,8 @@ add_swagger_documentation \ | |
| 337 350 | 
             
              ]
         | 
| 338 351 | 
             
            ```
         | 
| 339 352 |  | 
| 340 | 
            -
             | 
| 341 | 
            -
            #### hide_documentation_path: (default: `true`)
         | 
| 353 | 
            +
             | 
| 354 | 
            +
            #### hide_documentation_path: (default: `true`) <a name="hide_documentation_path" />
         | 
| 342 355 | 
             
            ```ruby
         | 
| 343 356 | 
             
            add_swagger_documentation \
         | 
| 344 357 | 
             
               hide_documentation_path: true
         | 
| @@ -346,8 +359,8 @@ add_swagger_documentation \ | |
| 346 359 |  | 
| 347 360 | 
             
            Don't show the `/swagger_doc` path in the generated swagger documentation.
         | 
| 348 361 |  | 
| 349 | 
            -
             | 
| 350 | 
            -
            #### info:
         | 
| 362 | 
            +
             | 
| 363 | 
            +
            #### info: <a name="info" />
         | 
| 351 364 | 
             
            ```ruby
         | 
| 352 365 | 
             
            add_swagger_documentation \
         | 
| 353 366 | 
             
              info: {
         | 
| @@ -385,8 +398,8 @@ add_swagger_documentation \ | |
| 385 398 | 
             
            ``` -->
         | 
| 386 399 |  | 
| 387 400 |  | 
| 388 | 
            -
             | 
| 389 | 
            -
            ## Routes Configuration
         | 
| 401 | 
            +
             | 
| 402 | 
            +
            ## Routes Configuration <a name="routes" />
         | 
| 390 403 |  | 
| 391 404 | 
             
            * [Swagger Header Parameters](#headers)
         | 
| 392 405 | 
             
            * [Hiding an Endpoint](#hiding)
         | 
| @@ -409,9 +422,9 @@ add_swagger_documentation \ | |
| 409 422 | 
             
            * [Extensions](#extensions)
         | 
| 410 423 |  | 
| 411 424 |  | 
| 412 | 
            -
            <a name="headers" />
         | 
| 413 | 
            -
            #### Swagger Header Parameters <a name="headers" />
         | 
| 414 425 |  | 
| 426 | 
            +
            #### Swagger Header Parameters  <a name="headers" />
         | 
| 427 | 
            +
             <a name="headers" />
         | 
| 415 428 | 
             
            Swagger also supports the documentation of parameters passed in the header. Since grape's ```params[]``` doesn't return header parameters we can specify header parameters seperately in a block after the description.
         | 
| 416 429 |  | 
| 417 430 | 
             
            ```ruby
         | 
| @@ -430,8 +443,8 @@ desc "Return super-secret information", { | |
| 430 443 | 
             
            ```
         | 
| 431 444 |  | 
| 432 445 |  | 
| 433 | 
            -
             | 
| 434 | 
            -
            #### Hiding an Endpoint
         | 
| 446 | 
            +
             | 
| 447 | 
            +
            #### Hiding an Endpoint <a name="hiding" />
         | 
| 435 448 |  | 
| 436 449 | 
             
            You can hide an endpoint by adding ```hidden: true``` in the description of the endpoint:
         | 
| 437 450 |  | 
| @@ -453,8 +466,8 @@ desc 'Conditionally hide this endpoint', hidden: lambda { ENV['EXPERIMENTAL'] != | |
| 453 466 | 
             
            ```
         | 
| 454 467 |  | 
| 455 468 |  | 
| 456 | 
            -
             | 
| 457 | 
            -
            #### Overriding Auto-Generated Nicknames
         | 
| 469 | 
            +
             | 
| 470 | 
            +
            #### Overriding Auto-Generated Nicknames <a name="overriding-auto-generated-nicknames" />
         | 
| 458 471 |  | 
| 459 472 | 
             
            You can specify a swagger nickname to use instead of the auto generated name by adding `:nickname 'string'``` in the description of the endpoint.
         | 
| 460 473 |  | 
| @@ -463,8 +476,8 @@ desc 'Get a full list of pets', nickname: 'getAllPets' | |
| 463 476 | 
             
            ```
         | 
| 464 477 |  | 
| 465 478 |  | 
| 466 | 
            -
             | 
| 467 | 
            -
            #### Specify endpoint details
         | 
| 479 | 
            +
             | 
| 480 | 
            +
            #### Specify endpoint details <a name="details" />
         | 
| 468 481 |  | 
| 469 482 | 
             
            To specify further details for an endpoint, use the `detail` option within a block passed to `desc`:
         | 
| 470 483 |  | 
| @@ -476,8 +489,8 @@ get '/kittens' do | |
| 476 489 | 
             
            ```
         | 
| 477 490 |  | 
| 478 491 |  | 
| 479 | 
            -
             | 
| 480 | 
            -
            #### Overriding the route summary
         | 
| 492 | 
            +
             | 
| 493 | 
            +
            #### Overriding the route summary <a name="summary" />
         | 
| 481 494 |  | 
| 482 495 | 
             
            To override the summary, add `summary: '[string]'` after the description.
         | 
| 483 496 |  | 
| @@ -492,8 +505,8 @@ end | |
| 492 505 | 
             
            ```
         | 
| 493 506 |  | 
| 494 507 |  | 
| 495 | 
            -
             | 
| 496 | 
            -
            #### Overriding the tags
         | 
| 508 | 
            +
             | 
| 509 | 
            +
            #### Overriding the tags <a name="tags" />
         | 
| 497 510 |  | 
| 498 511 | 
             
            Tags are used for logical grouping of operations by resources or any other qualifier. To override the
         | 
| 499 512 | 
             
            tags array, add `tags: ['tag1', 'tag2']` after the description.
         | 
| @@ -508,8 +521,8 @@ end | |
| 508 521 | 
             
            ```
         | 
| 509 522 |  | 
| 510 523 |  | 
| 511 | 
            -
             | 
| 512 | 
            -
            #### Defining an endpoint as an array
         | 
| 524 | 
            +
             | 
| 525 | 
            +
            #### Defining an endpoint as an array <a name="array" />
         | 
| 513 526 |  | 
| 514 527 | 
             
            You can define an endpoint as an array by adding `is_array` in the description:
         | 
| 515 528 |  | 
| @@ -518,8 +531,8 @@ desc 'Get a full list of pets', is_array: true | |
| 518 531 | 
             
            ```
         | 
| 519 532 |  | 
| 520 533 |  | 
| 521 | 
            -
             | 
| 522 | 
            -
            #### Using an options hash
         | 
| 534 | 
            +
             | 
| 535 | 
            +
            #### Using an options hash <a name="options" />
         | 
| 523 536 |  | 
| 524 537 | 
             
            The Grape DSL supports either an options hash or a restricted block to pass settings. Passing the `nickname`, `hidden` and `is_array` options together with response codes is only possible when passing an options hash.
         | 
| 525 538 | 
             
            Since the syntax differs you'll need to adjust it accordingly:
         | 
| @@ -539,8 +552,8 @@ get '/kittens' do | |
| 539 552 | 
             
            ```
         | 
| 540 553 |  | 
| 541 554 |  | 
| 542 | 
            -
             | 
| 543 | 
            -
            #### Overriding parameter type
         | 
| 555 | 
            +
             | 
| 556 | 
            +
            #### Overriding parameter type <a name="overriding-param-type" />
         | 
| 544 557 |  | 
| 545 558 | 
             
            You can override paramType, using the documentation hash. See [parameter object](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#parameter-object) for available types.
         | 
| 546 559 |  | 
| @@ -554,8 +567,8 @@ end | |
| 554 567 | 
             
            ```
         | 
| 555 568 |  | 
| 556 569 |  | 
| 557 | 
            -
             | 
| 558 | 
            -
            #### Overriding data type of the parameter
         | 
| 570 | 
            +
             | 
| 571 | 
            +
            #### Overriding data type of the parameter <a name="overriding-type-of-param" />
         | 
| 559 572 |  | 
| 560 573 | 
             
            You can override type, using the documentation hash.
         | 
| 561 574 |  | 
| @@ -579,8 +592,8 @@ end | |
| 579 592 | 
             
            ```
         | 
| 580 593 |  | 
| 581 594 |  | 
| 582 | 
            -
             | 
| 583 | 
            -
            #### Multiple types
         | 
| 595 | 
            +
             | 
| 596 | 
            +
            #### Multiple types <a name="multiple-types" />
         | 
| 584 597 |  | 
| 585 598 | 
             
            By default when you set multiple types, the first type is selected as swagger type
         | 
| 586 599 |  | 
| @@ -603,8 +616,8 @@ end | |
| 603 616 | 
             
            ```
         | 
| 604 617 |  | 
| 605 618 |  | 
| 606 | 
            -
             | 
| 607 | 
            -
            #### Array of data type
         | 
| 619 | 
            +
             | 
| 620 | 
            +
            #### Array of data type <a name="array-type" />
         | 
| 608 621 |  | 
| 609 622 | 
             
            Array types are also supported.
         | 
| 610 623 |  | 
| @@ -630,8 +643,8 @@ end | |
| 630 643 | 
             
            ```
         | 
| 631 644 |  | 
| 632 645 |  | 
| 633 | 
            -
             | 
| 634 | 
            -
            #### Collection format of arrays
         | 
| 646 | 
            +
             | 
| 647 | 
            +
            #### Collection format of arrays <a name="collection-format" />
         | 
| 635 648 |  | 
| 636 649 | 
             
            You can set the collection format of an array, using the documentation hash.
         | 
| 637 650 |  | 
| @@ -665,8 +678,8 @@ end | |
| 665 678 | 
             
            ```
         | 
| 666 679 |  | 
| 667 680 |  | 
| 668 | 
            -
             | 
| 669 | 
            -
            #### Hiding parameters
         | 
| 681 | 
            +
             | 
| 682 | 
            +
            #### Hiding parameters <a name="hiding-parameters" />
         | 
| 670 683 |  | 
| 671 684 | 
             
            Exclude single optional parameter from the documentation
         | 
| 672 685 |  | 
| @@ -681,8 +694,8 @@ end | |
| 681 694 | 
             
            ```
         | 
| 682 695 |  | 
| 683 696 |  | 
| 684 | 
            -
             | 
| 685 | 
            -
            #### Setting a Swagger default value
         | 
| 697 | 
            +
             | 
| 698 | 
            +
            #### Setting a Swagger default value <a name="default-value" />
         | 
| 686 699 |  | 
| 687 700 | 
             
            Grape allows for an additional documentation hash to be passed to a parameter.
         | 
| 688 701 |  | 
| @@ -752,8 +765,8 @@ end | |
| 752 765 | 
             
            ```
         | 
| 753 766 |  | 
| 754 767 |  | 
| 755 | 
            -
             | 
| 756 | 
            -
            #### Response documentation
         | 
| 768 | 
            +
             | 
| 769 | 
            +
            #### Response documentation <a name="response" />
         | 
| 757 770 |  | 
| 758 771 | 
             
            You can also document the HTTP status codes with a description and a specified model, as ref in the schema to the definitions, that your API returns with one of the following syntax.
         | 
| 759 772 |  | 
| @@ -815,8 +828,8 @@ The result is then something like following: | |
| 815 828 | 
             
            },
         | 
| 816 829 | 
             
            ```
         | 
| 817 830 |  | 
| 818 | 
            -
             | 
| 819 | 
            -
            #### Changing default status codes
         | 
| 831 | 
            +
             | 
| 832 | 
            +
            #### Changing default status codes <a name="change-status" />
         | 
| 820 833 |  | 
| 821 834 | 
             
            The default status codes, one could be found (-> [status codes](lib/grape-swagger/doc_methods/status_codes.rb)) can be changed to your specific needs, to achive it, you have to change it for grape itself and for the documentation.
         | 
| 822 835 |  | 
| @@ -841,8 +854,8 @@ end | |
| 841 854 | 
             
            },
         | 
| 842 855 | 
             
            ```
         | 
| 843 856 |  | 
| 844 | 
            -
             | 
| 845 | 
            -
            #### File response
         | 
| 857 | 
            +
             | 
| 858 | 
            +
            #### File response <a name="file-response" />
         | 
| 846 859 |  | 
| 847 860 | 
             
            Set `success` to `File` and sets also produces. If produces wasn't set, it defaults to `application/octet-stream`.
         | 
| 848 861 | 
             
            ```ruby
         | 
| @@ -868,8 +881,8 @@ end | |
| 868 881 | 
             
            }
         | 
| 869 882 | 
             
            ```
         | 
| 870 883 |  | 
| 871 | 
            -
             | 
| 872 | 
            -
            #### Extensions
         | 
| 884 | 
            +
             | 
| 885 | 
            +
            #### Extensions <a name="extensions" />
         | 
| 873 886 |  | 
| 874 887 | 
             
            Swagger spec2.0 supports extensions on different levels, for the moment,
         | 
| 875 888 | 
             
            the documentation on `info`, `verb`, `path` and `definition` level would be supported.
         | 
| @@ -940,8 +953,8 @@ route_setting :x_def, [{ for: 422, other: 'stuff' }, { for: 200, some: 'stuff' } | |
| 940 953 | 
             
            ```
         | 
| 941 954 |  | 
| 942 955 |  | 
| 943 | 
            -
             | 
| 944 | 
            -
            ## Using Grape Entities
         | 
| 956 | 
            +
             | 
| 957 | 
            +
            ## Using Grape Entities <a name="grape-entity" />
         | 
| 945 958 |  | 
| 946 959 | 
             
            Add the [grape-entity](https://github.com/ruby-grape/grape-entity) and [grape-swagger-entity](https://github.com/ruby-grape/grape-swagger-entity) gem to your Gemfile.
         | 
| 947 960 |  | 
| @@ -1060,8 +1073,8 @@ module API | |
| 1060 1073 | 
             
            end
         | 
| 1061 1074 | 
             
            ```
         | 
| 1062 1075 |  | 
| 1063 | 
            -
             | 
| 1064 | 
            -
            ## Securing the Swagger UI
         | 
| 1076 | 
            +
             | 
| 1077 | 
            +
            ## Securing the Swagger UI <a name="oauth" />
         | 
| 1065 1078 |  | 
| 1066 1079 |  | 
| 1067 1080 | 
             
            The Swagger UI on Grape could be secured from unauthorized access using any middleware, which provides certain methods:
         | 
| @@ -1131,8 +1144,8 @@ users, you could pass a lambda to the :hidden key of a endpoint's description: | |
| 1131 1144 | 
             
            The lambda is checking whether the user is authenticated (if not, the token_owner is nil by default), and has the admin
         | 
| 1132 1145 | 
             
            role - only admins can see this endpoint.
         | 
| 1133 1146 |  | 
| 1134 | 
            -
             | 
| 1135 | 
            -
            ## Markdown in Detail (deprecated)
         | 
| 1147 | 
            +
             | 
| 1148 | 
            +
            ## Markdown in Detail (deprecated) <a name="md_usage" />
         | 
| 1136 1149 |  | 
| 1137 1150 | 
             
            Usage of option `markdown` will no longer be supported,
         | 
| 1138 1151 | 
             
            cause OAPI accepts [GFM](https://help.github.com/articles/github-flavored-markdown) and plain text.
         | 
| @@ -1184,8 +1197,8 @@ end | |
| 1184 1197 | 
             
            ```
         | 
| 1185 1198 |  | 
| 1186 1199 |  | 
| 1187 | 
            -
             | 
| 1188 | 
            -
            ## Rake Tasks
         | 
| 1200 | 
            +
             | 
| 1201 | 
            +
            ## Rake Tasks <a name="rake" />
         | 
| 1189 1202 |  | 
| 1190 1203 | 
             
            Add these lines to your Rakefile, and initialize the Task class with your Api class – be sure your Api class is available.
         | 
| 1191 1204 |  | 
    
        data/Rakefile
    CHANGED
    
    
| @@ -39,7 +39,7 @@ module GrapeSwagger | |
| 39 39 | 
             
                  class_variables_from(options)
         | 
| 40 40 |  | 
| 41 41 | 
             
                  if formatter
         | 
| 42 | 
            -
                    %i | 
| 42 | 
            +
                    %i[format default_format default_error_formatter].each do |method|
         | 
| 43 43 | 
             
                      send(method, formatter)
         | 
| 44 44 | 
             
                    end
         | 
| 45 45 | 
             
                  end
         | 
| @@ -99,6 +99,7 @@ module GrapeSwagger | |
| 99 99 | 
             
                    format: :json,
         | 
| 100 100 | 
             
                    authorizations: nil,
         | 
| 101 101 | 
             
                    security_definitions: nil,
         | 
| 102 | 
            +
                    security: nil,
         | 
| 102 103 | 
             
                    api_documentation: { desc: 'Swagger compatible API description' },
         | 
| 103 104 | 
             
                    specific_api_documentation: { desc: 'Swagger compatible API description for specific API' },
         | 
| 104 105 | 
             
                    endpoint_auth_wrapper: nil,
         | 
| @@ -68,7 +68,7 @@ module GrapeSwagger | |
| 68 68 | 
             
                    end
         | 
| 69 69 |  | 
| 70 70 | 
             
                    def request_primitives
         | 
| 71 | 
            -
                      primitives + %w | 
| 71 | 
            +
                      primitives + %w[object string boolean file json array]
         | 
| 72 72 | 
             
                    end
         | 
| 73 73 |  | 
| 74 74 | 
             
                    def primitives
         | 
| @@ -80,22 +80,22 @@ module GrapeSwagger | |
| 80 80 | 
             
                    end
         | 
| 81 81 |  | 
| 82 82 | 
             
                    def collections
         | 
| 83 | 
            -
                      %w | 
| 83 | 
            +
                      %w[csv ssv tsv pipes multi]
         | 
| 84 84 | 
             
                    end
         | 
| 85 85 | 
             
                  end
         | 
| 86 86 |  | 
| 87 87 | 
             
                  PRIMITIVE_MAPPINGS = {
         | 
| 88 | 
            -
                    'integer' => %w | 
| 89 | 
            -
                    'long' => %w | 
| 90 | 
            -
                    'float' => %w | 
| 91 | 
            -
                    'double' => %w | 
| 92 | 
            -
                    'byte' => %w | 
| 93 | 
            -
                    'date' => %w | 
| 94 | 
            -
                    'dateTime' => %w | 
| 95 | 
            -
                    'binary' => %w | 
| 96 | 
            -
                    'password' => %w | 
| 97 | 
            -
                    'email' => %w | 
| 98 | 
            -
                    'uuid' => %w | 
| 88 | 
            +
                    'integer' => %w[integer int32],
         | 
| 89 | 
            +
                    'long' => %w[integer int64],
         | 
| 90 | 
            +
                    'float' => %w[number float],
         | 
| 91 | 
            +
                    'double' => %w[number double],
         | 
| 92 | 
            +
                    'byte' => %w[string byte],
         | 
| 93 | 
            +
                    'date' => %w[string date],
         | 
| 94 | 
            +
                    'dateTime' => %w[string date-time],
         | 
| 95 | 
            +
                    'binary' => %w[string binary],
         | 
| 96 | 
            +
                    'password' => %w[string password],
         | 
| 97 | 
            +
                    'email' => %w[string email],
         | 
| 98 | 
            +
                    'uuid' => %w[string uuid]
         | 
| 99 99 | 
             
                  }.freeze
         | 
| 100 100 | 
             
                end
         | 
| 101 101 | 
             
              end
         | 
| @@ -91,7 +91,7 @@ module GrapeSwagger | |
| 91 91 | 
             
                        'path'
         | 
| 92 92 | 
             
                      elsif param_type
         | 
| 93 93 | 
             
                        param_type
         | 
| 94 | 
            -
                      elsif %w | 
| 94 | 
            +
                      elsif %w[POST PUT PATCH].include?(value_type[:method])
         | 
| 95 95 | 
             
                        DataType.request_primitive?(value_type[:data_type]) ? 'formData' : 'body'
         | 
| 96 96 | 
             
                      else
         | 
| 97 97 | 
             
                        'query'
         | 
| @@ -29,6 +29,7 @@ module Grape | |
| 29 29 | 
             
                    produces:       content_types_for(target_class),
         | 
| 30 30 | 
             
                    authorizations: options[:authorizations],
         | 
| 31 31 | 
             
                    securityDefinitions: options[:security_definitions],
         | 
| 32 | 
            +
                    security: options[:security],
         | 
| 32 33 | 
             
                    host:           GrapeSwagger::DocMethods::OptionalObject.build(:host, options, request),
         | 
| 33 34 | 
             
                    basePath:       GrapeSwagger::DocMethods::OptionalObject.build(:base_path, options, request),
         | 
| 34 35 | 
             
                    schemes:        options[:schemes].is_a?(String) ? [options[:schemes]] : options[:schemes]
         | 
| @@ -149,7 +150,7 @@ module Grape | |
| 149 150 |  | 
| 150 151 | 
             
                  mime_types = GrapeSwagger::DocMethods::ProducesConsumes.call(format)
         | 
| 151 152 |  | 
| 152 | 
            -
                  route_mime_types = %i | 
| 153 | 
            +
                  route_mime_types = %i[formats content_types produces].map do |producer|
         | 
| 153 154 | 
             
                    possible = route.options[producer]
         | 
| 154 155 | 
             
                    GrapeSwagger::DocMethods::ProducesConsumes.call(possible) if possible.present?
         | 
| 155 156 | 
             
                  end.flatten.compact.uniq
         | 
| @@ -162,7 +163,7 @@ module Grape | |
| 162 163 | 
             
                  if route.settings[:description] && route.settings[:description][:consumes]
         | 
| 163 164 | 
             
                    format = route.settings[:description][:consumes]
         | 
| 164 165 | 
             
                  end
         | 
| 165 | 
            -
                  mime_types = GrapeSwagger::DocMethods::ProducesConsumes.call(format) if %i | 
| 166 | 
            +
                  mime_types = GrapeSwagger::DocMethods::ProducesConsumes.call(format) if %i[post put].include?(method)
         | 
| 166 167 |  | 
| 167 168 | 
             
                  mime_types
         | 
| 168 169 | 
             
                end
         | 
| @@ -286,7 +287,7 @@ module Grape | |
| 286 287 | 
             
                    param_type = param_type.to_s unless param_type.nil?
         | 
| 287 288 | 
             
                    array_key = name.to_s if param_type_is_array?(param_type)
         | 
| 288 289 | 
             
                    options[:is_array] = true if array_key && name.start_with?(array_key)
         | 
| 289 | 
            -
                    memo[name] = options unless %w | 
| 290 | 
            +
                    memo[name] = options unless %w[Hash Array].include?(param_type) && !options.key?(:documentation)
         | 
| 290 291 | 
             
                  end
         | 
| 291 292 | 
             
                end
         | 
| 292 293 |  | 
| @@ -7,8 +7,8 @@ describe '#537 enum values spec' do | |
| 7 7 | 
             
                Class.new(Grape::API) do
         | 
| 8 8 | 
             
                  namespace :issue_537 do
         | 
| 9 9 | 
             
                    class Spec < Grape::Entity
         | 
| 10 | 
            -
                      expose :enum_property, documentation: { values: %i | 
| 11 | 
            -
                      expose :enum_property_default, documentation: { values: %w | 
| 10 | 
            +
                      expose :enum_property, documentation: { values: %i[foo bar] }
         | 
| 11 | 
            +
                      expose :enum_property_default, documentation: { values: %w[a b c], default: 'c' }
         | 
| 12 12 | 
             
                      expose :own_format, documentation: { format: 'log' }
         | 
| 13 13 | 
             
                    end
         | 
| 14 14 |  | 
| @@ -30,13 +30,13 @@ describe '#537 enum values spec' do | |
| 30 30 | 
             
              let(:property) { subject['definitions']['Spec']['properties']['enum_property'] }
         | 
| 31 31 | 
             
              specify do
         | 
| 32 32 | 
             
                expect(property).to include 'enum'
         | 
| 33 | 
            -
                expect(property['enum']).to eql %w | 
| 33 | 
            +
                expect(property['enum']).to eql %w[foo bar]
         | 
| 34 34 | 
             
              end
         | 
| 35 35 |  | 
| 36 36 | 
             
              let(:property_default) { subject['definitions']['Spec']['properties']['enum_property_default'] }
         | 
| 37 37 | 
             
              specify do
         | 
| 38 38 | 
             
                expect(property_default).to include 'enum'
         | 
| 39 | 
            -
                expect(property_default['enum']).to eql %w | 
| 39 | 
            +
                expect(property_default['enum']).to eql %w[a b c]
         | 
| 40 40 | 
             
                expect(property_default).to include 'default'
         | 
| 41 41 | 
             
                expect(property_default['default']).to eql 'c'
         | 
| 42 42 | 
             
              end
         | 
| @@ -29,7 +29,7 @@ describe '#572 is_array is applied to all possible responses' do | |
| 29 29 | 
             
                JSON.parse(last_response.body)
         | 
| 30 30 | 
             
              end
         | 
| 31 31 |  | 
| 32 | 
            -
              let(:codes) { %w | 
| 32 | 
            +
              let(:codes) { %w[200 401 404 429] }
         | 
| 33 33 |  | 
| 34 34 | 
             
              let(:responses) { subject['paths']['/issue_572']['get']['responses'] }
         | 
| 35 35 |  | 
    
        data/spec/lib/endpoint_spec.rb
    CHANGED
    
    | @@ -52,7 +52,7 @@ describe Grape::Endpoint do | |
| 52 52 | 
             
                      let(:object) { subject.content_types_for(target_class) }
         | 
| 53 53 |  | 
| 54 54 | 
             
                      specify do
         | 
| 55 | 
            -
                        expect(object).to eql %w | 
| 55 | 
            +
                        expect(object).to eql %w[application/xml application/json text/plain]
         | 
| 56 56 | 
             
                      end
         | 
| 57 57 | 
             
                    end
         | 
| 58 58 | 
             
                  end
         | 
| @@ -41,19 +41,19 @@ describe GrapeSwagger::DocMethods::ParseParams do | |
| 41 41 | 
             
                  end
         | 
| 42 42 |  | 
| 43 43 | 
             
                  describe 'as Array' do
         | 
| 44 | 
            -
                    let(:values) { proc { %w | 
| 44 | 
            +
                    let(:values) { proc { %w[a b c] } }
         | 
| 45 45 | 
             
                    specify do
         | 
| 46 46 | 
             
                      parsed_range = subject.send(:parse_enum_or_range_values, values)
         | 
| 47 | 
            -
                      expect(parsed_range).to eql(enum: %w | 
| 47 | 
            +
                      expect(parsed_range).to eql(enum: %w[a b c])
         | 
| 48 48 | 
             
                    end
         | 
| 49 49 | 
             
                  end
         | 
| 50 50 | 
             
                end
         | 
| 51 51 |  | 
| 52 52 | 
             
                describe 'values as Array -> enums' do
         | 
| 53 | 
            -
                  let(:values) { %w | 
| 53 | 
            +
                  let(:values) { %w[a b c] }
         | 
| 54 54 | 
             
                  specify do
         | 
| 55 55 | 
             
                    parsed_range = subject.send(:parse_enum_or_range_values, values)
         | 
| 56 | 
            -
                    expect(parsed_range).to eql(enum: %w | 
| 56 | 
            +
                    expect(parsed_range).to eql(enum: %w[a b c])
         | 
| 57 57 | 
             
                  end
         | 
| 58 58 | 
             
                end
         | 
| 59 59 | 
             
              end
         | 
| @@ -8,7 +8,7 @@ describe GrapeSwagger::DocMethods::TagNameDescription do | |
| 8 8 | 
             
                subject { described_class.send(:build_memo, tag) }
         | 
| 9 9 |  | 
| 10 10 | 
             
                specify do
         | 
| 11 | 
            -
                  expect(subject.keys).to eql %i | 
| 11 | 
            +
                  expect(subject.keys).to eql %i[name description]
         | 
| 12 12 | 
             
                  expect(subject).to eql(
         | 
| 13 13 | 
             
                    name: tag,
         | 
| 14 14 | 
             
                    description: "Operations about #{tag.pluralize}"
         | 
| @@ -51,7 +51,7 @@ describe GrapeSwagger::DocMethods::TagNameDescription do | |
| 51 51 | 
             
                    describe 'uniq key' do
         | 
| 52 52 | 
             
                      let(:paths) do
         | 
| 53 53 | 
             
                        {
         | 
| 54 | 
            -
                          key_1: { post: { tags: %w | 
| 54 | 
            +
                          key_1: { post: { tags: %w[tags_given another_tag_given] } }
         | 
| 55 55 | 
             
                        }
         | 
| 56 56 | 
             
                      end
         | 
| 57 57 |  | 
    
        data/spec/lib/version_spec.rb
    CHANGED
    
    | @@ -9,7 +9,7 @@ describe GrapeSwagger::DocMethods::Version do | |
| 9 9 | 
             
              describe 'grape 0.16.2 version' do
         | 
| 10 10 | 
             
                let(:version) { '[:v1, :v2]' }
         | 
| 11 11 | 
             
                it { is_expected.to be_a Array }
         | 
| 12 | 
            -
                it { is_expected.to eql %i | 
| 12 | 
            +
                it { is_expected.to eql %i[v1 v2] }
         | 
| 13 13 | 
             
              end
         | 
| 14 14 |  | 
| 15 15 | 
             
              describe 'newer grape versions' do
         | 
| @@ -20,9 +20,9 @@ describe GrapeSwagger::DocMethods::Version do | |
| 20 20 | 
             
                end
         | 
| 21 21 |  | 
| 22 22 | 
             
                describe 'as Array' do
         | 
| 23 | 
            -
                  let(:version) { %i | 
| 23 | 
            +
                  let(:version) { %i[v1 v2] }
         | 
| 24 24 | 
             
                  it { is_expected.to be_a Array }
         | 
| 25 | 
            -
                  it { is_expected.to eql %i | 
| 25 | 
            +
                  it { is_expected.to eql %i[v1 v2] }
         | 
| 26 26 | 
             
                end
         | 
| 27 27 | 
             
              end
         | 
| 28 28 | 
             
            end
         | 
| @@ -11,7 +11,7 @@ RSpec.shared_context 'entity swagger example' do | |
| 11 11 | 
             
                  end
         | 
| 12 12 |  | 
| 13 13 | 
             
                  class EnumValues < Grape::Entity
         | 
| 14 | 
            -
                    expose :gender, documentation: { type: 'string', desc: 'Content of something.', values: %w | 
| 14 | 
            +
                    expose :gender, documentation: { type: 'string', desc: 'Content of something.', values: %w[Male Female] }
         | 
| 15 15 | 
             
                    expose :number, documentation: { type: 'integer', desc: 'Content of something.', values: [1, 2] }
         | 
| 16 16 | 
             
                  end
         | 
| 17 17 |  | 
| @@ -312,7 +312,7 @@ RSpec.shared_context 'entity swagger example' do | |
| 312 312 | 
             
                    },
         | 
| 313 313 | 
             
                    'QueryInputElement' => {
         | 
| 314 314 | 
             
                      'type' => 'object',
         | 
| 315 | 
            -
                      'required' => %w | 
| 315 | 
            +
                      'required' => %w[key value],
         | 
| 316 316 | 
             
                      'properties' => { 'key' => { 'type' => 'string', 'description' => 'Name of parameter' }, 'value' => { 'type' => 'string', 'description' => 'Value of parameter' } }
         | 
| 317 317 | 
             
                    },
         | 
| 318 318 | 
             
                    'ApiError' => {
         | 
| @@ -334,9 +334,9 @@ RSpec.shared_context 'entity swagger example' do | |
| 334 334 | 
             
                }
         | 
| 335 335 | 
             
              end
         | 
| 336 336 |  | 
| 337 | 
            -
              let(:http_verbs) { %w | 
| 337 | 
            +
              let(:http_verbs) { %w[get post put delete] }
         | 
| 338 338 | 
             
            end
         | 
| 339 339 |  | 
| 340 340 | 
             
            def mounted_paths
         | 
| 341 | 
            -
              %w | 
| 341 | 
            +
              %w[/thing /other_thing /dummy]
         | 
| 342 342 | 
             
            end
         | 
| @@ -330,9 +330,9 @@ RSpec.shared_context 'mock swagger example' do | |
| 330 330 | 
             
                }
         | 
| 331 331 | 
             
              end
         | 
| 332 332 |  | 
| 333 | 
            -
              let(:http_verbs) { %w | 
| 333 | 
            +
              let(:http_verbs) { %w[get post put delete] }
         | 
| 334 334 | 
             
            end
         | 
| 335 335 |  | 
| 336 336 | 
             
            def mounted_paths
         | 
| 337 | 
            -
              %w | 
| 337 | 
            +
              %w[/thing /other_thing /dummy]
         | 
| 338 338 | 
             
            end
         | 
| @@ -29,7 +29,7 @@ RSpec.shared_context 'representable swagger example' do | |
| 29 29 | 
             
                  class EnumValues < Representable::Decorator
         | 
| 30 30 | 
             
                    include Representable::JSON
         | 
| 31 31 |  | 
| 32 | 
            -
                    property :gender, documentation: { type: 'string', desc: 'Content of something.', values: %w | 
| 32 | 
            +
                    property :gender, documentation: { type: 'string', desc: 'Content of something.', values: %w[Male Female] }
         | 
| 33 33 | 
             
                    property :number, documentation: { type: 'integer', desc: 'Content of something.', values: [1, 2] }
         | 
| 34 34 | 
             
                  end
         | 
| 35 35 |  | 
| @@ -384,7 +384,7 @@ RSpec.shared_context 'representable swagger example' do | |
| 384 384 | 
             
                    },
         | 
| 385 385 | 
             
                    'QueryInputElement' => {
         | 
| 386 386 | 
             
                      'type' => 'object',
         | 
| 387 | 
            -
                      'required' => %w | 
| 387 | 
            +
                      'required' => %w[key value],
         | 
| 388 388 | 
             
                      'properties' => { 'key' => { 'type' => 'string', 'description' => 'Name of parameter' }, 'value' => { 'type' => 'string', 'description' => 'Value of parameter' } }
         | 
| 389 389 | 
             
                    },
         | 
| 390 390 | 
             
                    'ApiError' => {
         | 
| @@ -406,9 +406,9 @@ RSpec.shared_context 'representable swagger example' do | |
| 406 406 | 
             
                }
         | 
| 407 407 | 
             
              end
         | 
| 408 408 |  | 
| 409 | 
            -
              let(:http_verbs) { %w | 
| 409 | 
            +
              let(:http_verbs) { %w[get post put delete] }
         | 
| 410 410 | 
             
            end
         | 
| 411 411 |  | 
| 412 412 | 
             
            def mounted_paths
         | 
| 413 | 
            -
              %w | 
| 413 | 
            +
              %w[/thing /other_thing /dummy]
         | 
| 414 414 | 
             
            end
         | 
| @@ -26,7 +26,8 @@ describe 'global configuration stuff' do | |
| 26 26 | 
             
                                              mount_path: 'documentation',
         | 
| 27 27 | 
             
                                              add_base_path: true,
         | 
| 28 28 | 
             
                                              add_version: true,
         | 
| 29 | 
            -
                                              security_definitions: { api_key: { foo: 'bar' } }
         | 
| 29 | 
            +
                                              security_definitions: { api_key: { foo: 'bar' } },
         | 
| 30 | 
            +
                                              security: [{ api_key: [] }]
         | 
| 30 31 | 
             
                  end
         | 
| 31 32 | 
             
                end
         | 
| 32 33 | 
             
              end
         | 
| @@ -49,6 +50,7 @@ describe 'global configuration stuff' do | |
| 49 50 | 
             
                  expect(subject['schemes']).to eql ['https']
         | 
| 50 51 | 
             
                  expect(subject['securityDefinitions'].keys).to include('api_key')
         | 
| 51 52 | 
             
                  expect(subject['securityDefinitions']['api_key']).to include('foo' => 'bar')
         | 
| 53 | 
            +
                  expect(subject['security']).to include('api_key' => [])
         | 
| 52 54 | 
             
                end
         | 
| 53 55 | 
             
              end
         | 
| 54 56 | 
             
            end
         | 
| @@ -138,11 +138,11 @@ describe 'moving body/formData Params to definitions' do | |
| 138 138 | 
             
                                  'city' => { 'type' => 'string', 'description' => 'city' },
         | 
| 139 139 | 
             
                                  'country' => { 'type' => 'string', 'description' => 'country' }
         | 
| 140 140 | 
             
                                },
         | 
| 141 | 
            -
                                'required' => %w | 
| 141 | 
            +
                                'required' => %w[street postcode city]
         | 
| 142 142 | 
             
                              }
         | 
| 143 143 | 
             
                            }
         | 
| 144 144 | 
             
                          },
         | 
| 145 | 
            -
                          'required' => %w | 
| 145 | 
            +
                          'required' => %w[name]
         | 
| 146 146 | 
             
                        }
         | 
| 147 147 | 
             
                      },
         | 
| 148 148 | 
             
                      'description' => 'post in body with nested parameters'
         | 
| @@ -232,7 +232,7 @@ describe 'moving body/formData Params to definitions' do | |
| 232 232 | 
             
                              }
         | 
| 233 233 | 
             
                            }
         | 
| 234 234 | 
             
                          },
         | 
| 235 | 
            -
                          'required' => %w | 
| 235 | 
            +
                          'required' => %w[name]
         | 
| 236 236 | 
             
                        }
         | 
| 237 237 | 
             
                      },
         | 
| 238 238 | 
             
                      'description' => 'put in body with multiple nested parameters'
         | 
| @@ -26,7 +26,7 @@ describe 'Form Params' do | |
| 26 26 | 
             
                  params do
         | 
| 27 27 | 
             
                    requires :id, type: Integer, desc: 'id of item'
         | 
| 28 28 | 
             
                    requires :name, type: String, desc: 'name of item'
         | 
| 29 | 
            -
                    optional :conditions, type: String, desc: 'conditions of item', values: proc { %w | 
| 29 | 
            +
                    optional :conditions, type: String, desc: 'conditions of item', values: proc { %w[1 2] }
         | 
| 30 30 | 
             
                  end
         | 
| 31 31 | 
             
                  patch '/items/:id' do
         | 
| 32 32 | 
             
                    {}
         | 
| @@ -35,7 +35,7 @@ describe 'Form Params' do | |
| 35 35 | 
             
                  params do
         | 
| 36 36 | 
             
                    requires :id, type: Integer, desc: 'id of item'
         | 
| 37 37 | 
             
                    requires :name, type: String, desc: 'name of item'
         | 
| 38 | 
            -
                    optional :conditions, type: Symbol, desc: 'conditions of item', values: %i | 
| 38 | 
            +
                    optional :conditions, type: Symbol, desc: 'conditions of item', values: %i[one two]
         | 
| 39 39 | 
             
                  end
         | 
| 40 40 | 
             
                  post '/items/:id' do
         | 
| 41 41 | 
             
                    {}
         | 
| @@ -61,7 +61,7 @@ describe 'Form Params' do | |
| 61 61 | 
             
                expect(subject['paths']['/items/{id}']['post']['parameters']).to eq [
         | 
| 62 62 | 
             
                  { 'in' => 'path', 'name' => 'id', 'description' => 'id of item', 'type' => 'integer', 'required' => true, 'format' => 'int32' },
         | 
| 63 63 | 
             
                  { 'in' => 'formData', 'name' => 'name', 'description' => 'name of item', 'type' => 'string', 'required' => true },
         | 
| 64 | 
            -
                  { 'in' => 'formData', 'name' => 'conditions', 'description' => 'conditions of item', 'type' => 'string', 'required' => false, 'enum' => %w | 
| 64 | 
            +
                  { 'in' => 'formData', 'name' => 'conditions', 'description' => 'conditions of item', 'type' => 'string', 'required' => false, 'enum' => %w[one two] }
         | 
| 65 65 | 
             
                ]
         | 
| 66 66 | 
             
              end
         | 
| 67 67 | 
             
            end
         | 
| @@ -9,13 +9,13 @@ describe 'Convert values to enum or Range' do | |
| 9 9 | 
             
                  format :json
         | 
| 10 10 |  | 
| 11 11 | 
             
                  params do
         | 
| 12 | 
            -
                    requires :letter, type: String, values: %w | 
| 12 | 
            +
                    requires :letter, type: String, values: %w[a b c]
         | 
| 13 13 | 
             
                  end
         | 
| 14 14 | 
             
                  post :plain_array do
         | 
| 15 15 | 
             
                  end
         | 
| 16 16 |  | 
| 17 17 | 
             
                  params do
         | 
| 18 | 
            -
                    requires :letter, type: String, values: proc { %w | 
| 18 | 
            +
                    requires :letter, type: String, values: proc { %w[d e f] }
         | 
| 19 19 | 
             
                  end
         | 
| 20 20 | 
             
                  post :array_in_proc do
         | 
| 21 21 | 
             
                  end
         | 
| @@ -51,7 +51,7 @@ describe 'Convert values to enum or Range' do | |
| 51 51 | 
             
                    'name' => 'letter',
         | 
| 52 52 | 
             
                    'type' => 'string',
         | 
| 53 53 | 
             
                    'required' => true,
         | 
| 54 | 
            -
                    'enum' => %w | 
| 54 | 
            +
                    'enum' => %w[a b c]
         | 
| 55 55 | 
             
                  }]
         | 
| 56 56 | 
             
                end
         | 
| 57 57 | 
             
              end
         | 
| @@ -65,7 +65,7 @@ describe 'Convert values to enum or Range' do | |
| 65 65 | 
             
                    'name' => 'letter',
         | 
| 66 66 | 
             
                    'type' => 'string',
         | 
| 67 67 | 
             
                    'required' => true,
         | 
| 68 | 
            -
                    'enum' => %w | 
| 68 | 
            +
                    'enum' => %w[d e f]
         | 
| 69 69 | 
             
                  }]
         | 
| 70 70 | 
             
                end
         | 
| 71 71 | 
             
              end
         | 
| @@ -125,7 +125,7 @@ describe 'Group Params as Array' do | |
| 125 125 | 
             
                        'type' => 'integer', 'format' => 'int32', 'description' => 'nested array of integers'
         | 
| 126 126 | 
             
                      }
         | 
| 127 127 | 
             
                    },
         | 
| 128 | 
            -
                    'required' => %w | 
| 128 | 
            +
                    'required' => %w[array_of_string array_of_integer]
         | 
| 129 129 | 
             
                  )
         | 
| 130 130 | 
             
                end
         | 
| 131 131 | 
             
              end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: grape-swagger
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.27. | 
| 4 | 
            +
              version: 0.27.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Tim Vandecasteele
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2017- | 
| 11 | 
            +
            date: 2017-04-28 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: grape
         | 
| @@ -178,7 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 178 178 | 
             
                  version: '0'
         | 
| 179 179 | 
             
            requirements: []
         | 
| 180 180 | 
             
            rubyforge_project: 
         | 
| 181 | 
            -
            rubygems_version: 2.6. | 
| 181 | 
            +
            rubygems_version: 2.6.11
         | 
| 182 182 | 
             
            signing_key: 
         | 
| 183 183 | 
             
            specification_version: 4
         | 
| 184 184 | 
             
            summary: Add auto generated documentation to your Grape API that can be displayed
         |