-
Notifications
You must be signed in to change notification settings - Fork 23
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
Add endpoint to retrieve all request mappings as JSON #265
Conversation
This introduces an HTTP endpoint which delivers all HTTP endpoints as JSON objects. Hereby all instances (types and methods) annotated with @RequestMapping annotations in @controller classes are analyzed.
Nice! How well does this play with swagger? Is this related somehow? Is the format you return otherwise standardized? |
This is default format Spring offers us out of the box. I doubt that there is any relation to Swagger or that this is a standardized format. springfox seems to offer a nice way to get a Swagger-compatible API-documentation. Maybe someone finds the time to test and come up with another PR extending this |
Ping @buehner wrt to security I am 👍 |
Nice addition! Thx @chrismayer Regarding security we can think about encapsulating the trivial controller logic in a service. The service could easily be secured with an annotation to avoid that everyone can consume this endpoint to retrieve information for possible attacks!? But i'm not really sure in this point... |
Thanks for the feedback guys! I agree that we can encapsulate the logic in service, so we are able to secure this interface. @buehner: Do you have a suggestion for a security level? I would suggest
like is done in other GET requests. |
I think |
In order to secure the endpoint to retrieve all request mappings this introduces a service layer with a '@PreAuthorize' annotation.
Right @buehner, Would be cool if you could have another look at it. |
* | ||
* @author Christian Mayer | ||
*/ | ||
@Service("endpoinDocService") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think there is a small typo (missing "t") 😉
* The service layer instance | ||
*/ | ||
@Autowired | ||
@Qualifier("endpoinDocService") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above. (missing "t") 😉
Just found a small typo. If this is fixed: Feel free to merge 👍 |
Thanks again for your review @buehner! I adressed your comment and will merge now. |
This introduces an HTTP-endpoint
/endpointdoc
which delivers all mapped HTTP endpoints as JSON objects. Hereby all instances (types and methods) annotated with@RequestMapping
annotations in@Controller
classes are analyzed.This is very useful to build an automated API documentation for all HTTP endpoints.
Sample output: