Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

api-docs.json incorrectly prefixed apis path #19

Closed
dsiu opened this Issue May 15, 2013 · 5 comments

Comments

Projects
None yet
4 participants

dsiu commented May 15, 2013

Looking at the petstore example, the api-docs.json is as follow:

http://petstore.swagger.wordnik.com/api/api-docs.json

{
        apiVersion: "0.2",
        swaggerVersion: "1.1",
        basePath: "http://petstore.swagger.wordnik.com/api",
        apis: 
[
        
{
        path: "/api-docs.{format}/user",
        description: ""
        },
        
{
        path: "/api-docs.{format}/pet",
        description: ""
        }
        ]
}

where as swagger-jack generated api-docs.json is:

{
        apiVersion: "2.0",
        swaggerVersion: "1.1",
        basePath: "http://local.host:3000/api",
        apis: 
[
        
{
        path: "/api/api-docs.json/users"
        },
        
     
{
        path: "/api/api-docs.json/orgs"
        },
        
{
        path: "/api/api-docs.json/projects"
        }
        ]
}

The extra leading "/api" at apis[0].path breaks swagger-ui which prepends basePath to apis.path for fetching api specs.

@dsiu dsiu closed this May 15, 2013

@feugy feugy added a commit that referenced this issue May 21, 2013

@feugy feugy Fix #19: do not prepend basePath to api's path with swagger root desc…
…riptor

Enforce validator on api declared with basePath
259b654

dsiu commented May 29, 2013

apis[0].path is now missing leading slash in 1.6.1

{
  apiVersion : "2.0",
  basePath : "http://local.host:3000/api",
  swaggerVersion : "1.1",
  apis : [
    {
      path : "api-docs.json/users"
    },
    {
      path : "api-docs.json/causes"
    },
    {
      path : "api-docs.json/orgs"
    },
    {
      path : "api-docs.json/countries"
    },
    {
      path : "api-docs.json/regions"
    },
    {
      path : "api-docs.json/projects"
    }
  ]
}

@dsiu dsiu reopened this May 29, 2013

Same problem here. This breaks in the Swagger UI.

cvolk94 commented Jun 5, 2013

I can confirm this issue as well. Happens with non-default descPath as well as api-docs.json/.

dsiu commented Jun 19, 2013

@feugy do you think you have time to fix this? if not, I can submit a pull request.

@feugy feugy closed this in 1354c63 Jun 20, 2013

Contributor

feugy commented Jun 20, 2013

Hi guys.

Sorry for being that long to fix this. Too much Open Source project at the same time !
Version 1.6.2 is released on NPM.

see ya

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment