springfox icon indicating copy to clipboard operation
springfox copied to clipboard

Missing basePath & "default" word in controller at api-docs

Open toshim45 opened this issue 12 years ago • 2 comments

Hello!! I have an apps which use Spring MVC 3.2.8, Swagger-springmvc 0.8.5 & Swagger UI. I successully setup all of those and open the UI from browser. I have a controller called home, it has GET request method, and just return a string. swagger-ui-1 But when I executed it from "try it out" swagger-ui-2 the request url is wrong.

This is my api-docs :

http://localhost:8080/my-app/api-docs
{
    "apiVersion": "1.0",
    "swaggerVersion": "1.2",
    "apis": [
        {
            "path": "/default/home-controller",
            "description": "Home Controller"
        }
    ],
    "info": {
        "title": "default Title",
        "description": "Api Description",
        "termsOfServiceUrl": "Api terms of service",
        "contact": "Contact Email",
        "license": "Licence Type",
        "licenseUrl": "License URL"
    }
}

I can open the swagger api home controller

http://localhost:8080/my-app/api-docs/default/home-controller
{
    "apiVersion": "1.0",
    "swaggerVersion": "1.2",
    "basePath": "/",
    "resourcePath": "fix this",
    "apis": [
        {
            "path": "/home",
            "description": "home",
            "operations": [
                {
                    "method": "GET",
                    "summary": "home",
                    "notes": "home",
                    "type": "string",
                    "nickname": "home",
                    "parameters": [ ],
                    "responseMessages": [
                        {
                            "code": 404,
                            "message": "Not Found"
                        },
                        {
                            "code": 403,
                            "message": "Forbidden"
                        },
                        {
                            "code": 401,
                            "message": "Unauthorized"
                        },
                        {
                            "code": 200,
                            "message": "OK",
                            "responseModel": "string"
                        }
                    ],
                    "deprecated": "false"
                }
            ]
        }
    ]
}

I use xml spring configuration swagger-ui-3

My questions are :

  1. where should I set the basePath "my-app" ? so the "try it out" will executed to the right URL
  2. is the "default" word in "path": "/default/home-controller", is normal ?
  3. where can I set API info on the api-docs ?

Thanks in advance.

toshim45 avatar Aug 15 '14 09:08 toshim45

Could you try 0.8.6 and see if that fixes your problem

dilipkrish avatar Aug 15 '14 11:08 dilipkrish

0.8.7 fix my problem, thanx @dilipkrish

toshim45 avatar Aug 15 '14 23:08 toshim45