Skip to content

Multiple swagger endpoints for multiple API versions? #141

Open
@mepatterson

Description

@mepatterson

Is there a way to do this, or am I missing something... ?

I have:

module API
  class Base < GrapeApi::API
    mount API::V1::Robots
    mount API::V1::Pirates
    mount API::V1::Ninjas
    mount API::AdminV1::Robots
    mount API::AdminV1::Activities
  end
end

Within each of those mounted classes, I specify the proper version, so there are two discrete versions in my API system ("v1" and "admin.v1")

add_swagger_documentation works, and documents all of the endpoints on all of those API mounts, but I get a bunch of duplicates -- /robots (v1) and /robots (admin.v1), for example -- with no real way to distinguish them, since Swagger UI doesn't know how to distinguish.

What I would like to do is be able to add_swagger_documentation for all the V1s responding to "/docs/v1" and all the admin endpoints responding to "/docs/admin.v1" ... so effectively it would be running grape-swagger twice, but separating those versions. And then I can just point Swagger UI at whichever URI I want, depending on which version of docs I want to look at.

Is this supposed to work automatically with grape-swagger, or am I missing something?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions