Skip to content
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

@ignore not working on spring @RequestAttribute parameter #1068

Closed
Honatas opened this issue Dec 21, 2020 · 6 comments
Closed

@ignore not working on spring @RequestAttribute parameter #1068

Honatas opened this issue Dec 21, 2020 · 6 comments
Milestone

Comments

@Honatas
Copy link

Honatas commented Dec 21, 2020

I have a Spring REST application where I get JWT data in a HandlerInterceptor, and add the parsed data as a request attribute to be recovered by the controller method in a parameter annotated with @RequestAttribute. I don't want this to be part of the method documentation, so I have annotated (javadoc) the class with @ignore, but Enunciate still outputs the parameter.

This is the method signature on the controller:
public MyResponse myMethod(@RequestAttribute("jwtData") JWTData jwtData)

The class JWTData is the one with the @ignore annotation on the javadoc. Enunciate outputs every field of JWTData as a request parameter. Annotating every field also does not work.

/**
 * @ignore
 */
public class JWTData {
    /** @ignore */
    private Long id;
}

The class JWTData is in the same package of other classes who are getting documentend correctly, as configured with the include tag on enunciate.xml.

@panchenko
Copy link
Contributor

Have you tried the java annotation for the parameter?

public MyResponse myMethod(@Ignore @RequestAttribute("jwtData") JWTData jwtData)

However, ideally I think all the parameters annotated with @RequestAttribute should be ignored automatically.

@Honatas
Copy link
Author

Honatas commented Dec 22, 2020

@panchenko I have not. But the main reason I chose Enunciate in the first place is to have documentation written in javadoc, not annotations. Also, I belive this is a bug, that's why I have reported it.

@panchenko
Copy link
Contributor

@Honatas possible, however if you say "Annotating every field also does not work" - then it means some build misconfiguration, so enunciate is not able to find the sources.

There is documentation in https://github.com/stoicflame/enunciate/wiki/Discovering-Source-Files
Please check it.

@Honatas
Copy link
Author

Honatas commented Dec 22, 2020

@panchenko as I have stated earlier, the class JWTData is in the same package as other classes who are being correctly documented. The enunciate.xml file has a single include statement, like this:

<api-classes>
    <include pattern="com.my.company.project.rest.**"/>
</api-classes>

All classes who are already generating the docs are under subpackages of package com.my.company.project.rest. Also, have in mind that I meant "Annotating every field with @ignore also does not work".

@stoicflame
Copy link
Owner

Thanks for the report @Honatas . I agree @RequestAttribute should be ignored for documentation purposes. I've pushed 05d603c to address this.

@stoicflame stoicflame added this to the 2.14.0 milestone Dec 28, 2020
@stoicflame
Copy link
Owner

Fixed in 2.13.3.

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

No branches or pull requests

3 participants