grape-swagger icon indicating copy to clipboard operation
grape-swagger copied to clipboard

how to document implicit (path?) parameters that are in the url path

Open tansaku opened this issue 4 years ago • 0 comments

It wasn't immediately clear to me what syntax I would use to document examples and other info for an implicit parameter defined by a symbol in the URL path, e.g.

        desc 'return a specific check', {
          headers: SWAGGER_HEADERS,
        }
        get '/:id' do

as opposed to

        desc 'return a specific check', {
          headers: SWAGGER_HEADERS,
        }
        params do
          requires :id, type: String, documentation: { example: '7', desc: 'Unique Identifier' }
        end
        get '/' do

i tried:

 get '/:id', documentation: { example: '7', desc: 'Unique Identifier' } do

but that didn't seem to work ... at least the presence of a path parameter generates a little chunk of swagger liks this:

          {
            "in": "path",
            "name": "id",
            "type": "integer",
            "format": "int32",
            "required": true
          }

but I was wondering if there was some syntax to add an example and/or desc to this ...

tansaku avatar May 28 '21 15:05 tansaku