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

Problems with base_path

otobrglez opened this issue · comments

Hey guys!

So. If I have configuration like following one:

Swagger::Docs::Config.register_apis('1.0' => {
    controller_base_path: '',
    api_extension_type: '',
    api_file_path: 'public/',
    base_path: '/', # <- THIS
    clean_directory: true,
    attributes: { }
})

This gets converted to json like this:

{
  "apiVersion": "1.0",
  "swaggerVersion": "1.2",
  "basePath": "",
  "apis": [
    {
      "path": "/questions.{format}",
      "description": "Questions"
    }
  ],
  "authorizations": null,
}

See the basePath in JSON. It should be / and not empty string. Or am I wrong? Any ideas?

Cheers and thanks for your effort!

commented

This is confusing me too. The readme says base_path defaults to '/' (https://github.com/richhollis/swagger-docs#configuration-options). Is it the expected behavior?

Btw, thanks for the great work!

Yup, this is broken. base_path should almost certainly be '/' by default - it is not. What's more, setting it to be '/' does not work. Nor does '//', nor '/'.