teamcarma / swagger-jaxrs-doclet

This fork is no longer actively maintained, please switch to https://github.com/conorroche/swagger-doclet
Apache License 2.0
81 stars 38 forks source link

Generic Types (non-GenericWrapperTypes) #136

Open ghost opened 8 years ago

ghost commented 8 years ago

Hello

in the ParserHelper you are generally using "qualifiedTypeName" which works fine except when i have something like this

    @GET
    @Path("bar")
    public Dto<Bar> bar() {
        return null;
    }

    @GET
    @Path("foo")
    public Dto<Foo> foo() {
        return null;
    }

which will result in

        {
            "path": "/api/bar",
            "operations": [
                {
                    "method": "GET",
                    "nickname": "bar",
                    "type": "Dto"
                }
            ]
        },
        {
            "path": "/api/foo",
            "operations": [
                {
                    "method": "GET",
                    "nickname": "foo",
                    "type": "Dto"
                }
            ]
        }

but what you actually want is something like this

        {
            "path": "/api/bar",
            "operations": [
                {
                    "method": "GET",
                    "nickname": "bar",
                    "type": "Dto<Bar>"
                }
            ]
        },
        {
            "path": "/api/foo",
            "operations": [
                {
                    "method": "GET",
                    "nickname": "foo",
                    "type": "Dto<Foo>"
                }
            ]
        }

Using the 'genericWrapperTypes' command line switch is not really an option, because it's not really a wrapper - it contains additional fields that need to be present in the documentation. So what i did as a workaround is returning 'type.ToString()' in 'ParserHelper.getQualifiedTypeName' which solves this problem, but breaks with the existing api, and also my implementation is more than ugly... Any suggestions before I try to clean my implementation (or feel free to do it yourselves:))?

cheers

ghost commented 8 years ago

duplicates #7

ghost commented 8 years ago

is also the same as https://github.com/conorroche/swagger-doclet/issues/10