wkennedy / swagger4spring-web

Swagger support for Spring MVC
89 stars 46 forks source link

API's disappearing when adding @Api to a controller #66

Open MartinAhrer opened 10 years ago

MartinAhrer commented 10 years ago

I have multiple controllers providing several endpoints as shown below

{"apiVersion": "TODO", "swaggerVersion": "1.2", "apis": [
    {
        "path": "/doc/userAccounts",
        "description": null,
        "position": 0
    },
    {
        "path": "/doc/dictionaries/userAccounts",
        "description": null,
        "position": 0
    },
    {
        "path": "/doc/dictionaries/userGroups",
        "description": null,
        "position": 0
    },
    {
        "path": "/doc/userGroups",
        "description": null,
        "position": 0
    },
    {
        "path": "/doc/userGroups/{reference}/memberships",
        "description": null,
        "position": 0
    }
], "authorizations": null, "info": null}

I need a description attached to the API, but as soon as I add the @Api annotation to one of the controllers:

@Api(value = "User Account API documentation", description = "User Account API documentation (long)")

@Controller
@ExposesResourceFor(UserAccountResource.class)
@RequestMapping(value = UserAccountController.REQUEST_MAPPING_PATH, produces = {"application/json"})
public class UserAccountController {
    public static final String REQUEST_MAPPING_PATH = "/userAccounts";

This one endpoint is lost from the resource listing:

{"apiVersion": "TODO", "swaggerVersion": "1.2", "apis": [
    {
        "path": "/doc/dictionaries/userAccounts",
        "description": null,
        "position": 0
    },
    {
        "path": "/doc/dictionaries/userGroups",
        "description": null,
        "position": 0
    },
    {
        "path": "/doc/userGroups",
        "description": null,
        "position": 0
    },
    {
        "path": "/doc/userGroups/{reference}/memberships",
        "description": null,
        "position": 0
    }
], "authorizations": null, "info": null}

Using 0.3.3