richhollis / swagger-docs

Generates swagger-ui json files for Rails APIs with a simple DSL.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to configure `path` in `api-docs.json`

skatenerd opened this issue · comments

When I generate documentation, this line comes out as "path": "/foo.{format}". foo is presumably derived from the name of the controller that serves this route.

Is there any way to change foo to a value that I control?

In particular, foo is inconsistent with the paths contained in the resource-specific documentation. So, in other words, I have:

# api_documentation/foo.json
{
  "apiVersion": "1.0",
  "swaggerVersion": "1.2",
  "basePath": "http://mysite.com",
  "resourcePath": "/bar",
  "apis": [
    {
      "path": "/bar/{param}.json",
      "operations": [
        {
          "summary": "Get a thing",
          "parameters": [{...}],
          "nickname": "FooController#method",
          "method": "get"
        }
      ]
    },
  ]
}
# api_documentation/api-docs.json
{
  "apiVersion": "1.0",
  "swaggerVersion": "1.2",
  "basePath": "http://mysite.com",
  "apis": [
    {
      "path": "/foo.{format}",
      "description": "Get Info On Things"
    }
  ]
}

And I would like to be consistently showing bar instead of foo.

Is there a way to do this without renaming my controller?