New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

question: @ApiObject ignored for ParameterizedType return objects #151

Closed
piccarsa opened this Issue Sep 29, 2015 · 0 comments

Comments

Projects
None yet
2 participants
@piccarsa
Contributor

piccarsa commented Sep 29, 2015

Hi Fabio,

first of all thanks for this really cool library!

I noticed that when the return-object of a controller-method is parameterized the principal class is ignored , also if it is annotated with @ApiObject.

If you take the subsequent example, the FooWrapper<T> class won't be documented by JSONDoc.
Is this how it is supposed to work? If yes, how can I let the FooWrapper will be documented too?

Here the example:

In the subsequent example the BarPojo will be documented in the Objects > BARGROUP section of jsondoc-ui, while the FooWrapper won't appear in the documentation.

The Controller:

@Api(name = "Foo Services", description = "bla, bla, bla ...", group = "foogroup")
@RestController
@RequestMapping("/api/foo")
public class FooController {

    @ApiMethod(
                produces = { MediaType.APPLICATION_JSON_VALUE }, 
                consumes = { MediaType.APPLICATION_JSON_VALUE }, 
                path = { "/api/foo" }, 
                description = "Main foo service")
    @RequestMapping(value = "", method = RequestMethod.GET)
    @ResponseStatus(HttpStatus.ACCEPTED)
    @ApiResponseObject
    @ResponseBody
    public FooWrapper<BarPojo> getBar() {
                // here the code
    }

The return-object, notice that it wraps the real object:

@ApiObject(group="foogroup", description="Foo description")
public class FooWrapper<T> {

    @ApiObjectField(description="The wrapper's content")
    private T content;

        // getters and setters
}

The return-object, the wrapped one:

@ApiObject(group="bargroup", description="Bar description")
public class BarPojo {

    @ApiObjectField(description="Bar description")
    private String barField;

        // getters and setters
}

@fabiomaffioletti fabiomaffioletti modified the milestone: 1.2.8 Oct 2, 2015

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