Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tansaku opened this issue May 28, 2021 · 0 comments
Open

Comments

@tansaku
Copy link

tansaku commented May 28, 2021

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 ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant