ruby-grape / ruby-grape/grape-swagger

Configuring swagger for multiple API versions

Open
#316 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Has anyone found a solution for getting grape-swagger to support multiple versions at the same time. For example I have a structure like

/lib/api/root.rb
lib/api/v1/root.rb
lib/api/v2/root.rb
lib/api/v4/root.rb
etc...

If I put the 'add_documentation api_version: "v1"' in any of the root.rb files, swagger does pick up all APIs underneath and mark them as v1 but obviously I'd want those under v2 and v3 to be marked appropriately.

I am able to for example put 'add_documentation api_version: "v2"' in the v2 root.rb but then I only get docs for v2. If I 'add_documentation api_version: '' in all of the root.rb files only 1 gets picked up.

So, is there any way to publish all versions via swagger? Thanks in advance!

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

Start with the versioned entry points in lib/api/root.rb, lib/api/v1/root.rb, lib/api/v2/root.rb, and lib/api/v4/root.rb, and review how add_documentation api_version is applied. Determine whether grape-swagger can publish all versions while preserving their version labels; done means the generated Swagger documentation includes each API version correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, ruby
Domain
api, documentation
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.