ruby-grape / ruby-grape/grape-swagger

Accept lambda/proc in security definitions for relative urls

Open
#665 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
1.1k
Forks
479
Avg merge
2d 14h
Merged PRs (30d)
6

Description

For example:

        security_definitions: {
          ResourceOwner: {
            type: 'oauth2',
            description: 'OAuth 2 with the password grant flow',
            flow: 'password',
            tokenUrl: -> {|request| "#{request.host}/api/v1/oauth/token"}
          }
        }

When using Swagger UI, it can allow a relative URL, but it really needs an absolute URL to point to the same server that enables authorizations.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file or test is named. Start by locating the security_definitions handling for tokenUrl, then reproduce the shown Proc or lambda example and check that the generated Swagger UI authorization URL is absolute and points to the same server.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
api, documentation
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.