-
-
Notifications
You must be signed in to change notification settings - Fork 53
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
fixes #67, fixes #1: Migrate to Jersey 2 and Swagger #70
Conversation
wow, thats a good one. I have to take a bit of time to test it. |
ac5050f
to
2ce034b
Compare
Rebased. |
Testing on 4.7.0 master looks stable. Read and Write requests have identical behaviour and body content as master. |
38157e7
to
8a47fbc
Compare
I think I've added documentation for all endpoints. This is ready for review. |
Note that the Swagger documentation that's added in this PR can't be used 'offline'. We still need to replace the static documentation (in readme.html) with something that's generated during compilation/packaging. This effort is tracked as issue #71. I'm not sure if I get around to doing that soon (the holidays have come to an end :) ). Is this PR acceptable as-is? |
This is great! I've even found a few new bugs using the swagger tool :) |
All of the descriptions look accurate. I've added one tiny tweak to mirror the same constraint on usergroup updates. |
I don't recall that we can set defaults, but I think we can have more meaningful examples (with more valid-looking data than 'string').
I tried & failed. It should be easy - but disabling wadl support (which should prevent that documentation to be added didn't actually seem to disable wadl support. I'd be happy for that to be done, as I suspect that the endpoints won't be functional anyway. |
FWIW, the values in the page default to the examples you configure in the code. |
@Redor what do you think? For the 4.7.0 release of Openfire, we will need to publish a new version of this plugin. I'd love to include this PR. |
It does look good, but didn't had the time to test it. (I will be tomorrow back from vacation). Will review it ASAP |
@Override | ||
public ContainerRequest filter(ContainerRequest containerRequest) throws WebApplicationException { | ||
public void filter(ContainerRequestContext containerRequest) throws IOException { | ||
if (containerRequest.getUriInfo().getRequestUri().getPath().equals("/plugins/restapi/v1/openapi.yaml")) { |
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.
Should we exclude it? In swagger UI we can set the secret key. I think we should make fewer "exceptions" in the authentication part, which is crucial.
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.
My reasoning for it to include it is for non-authenticated users to make use of the Swagger UI, which needs this file.
Every request made from the Swagger UI obviously needs to be authenticated, but that can be achieved through the Swagger UI-provided functionality.
ServiceException seems not to work, to show specific Error and status codes. E.g. instead of a "bad request", I'm getting always 500. Probably the handling is slightly different in jersey 2 or something specific to that request. Example:
which should be Bad request (because password is missing), but 500 will be returned |
Another problem on a similar vein.
Using XML doesn't encounter the same issue. Something to do with the JSON representation not happy with the |
2dfe26f
to
af31ebe
Compare
The RestExceptionMapper didn't automatically register. I have now modified the code to do that manually which fixes the problem. |
This updates the Jersey dependency from 1.x to 2.x. This commit requires OF-2352 / igniterealtime/Openfire#1945 which means that this PR will _not_ work with 4.7.0 beta (but hopefully will with 4.7.0 non-beta).
This commit introduces an automatically generated Swagger-based REST client on /plugins/restapi/docs/index.html Note that this can't be used 'offline'. We still need to replace the static documentation (in readme.html) with something that's generated during compilation/packaging (issue igniterealtime#71)
By adding certain annotations, the documentation as generated by Swagger becomes enriched.
af31ebe
to
863bd66
Compare
Do you know if that happened before this PR? If so, I'd rather take on this issue in a separate effort. |
Tested. It's new :( |
Am I right to conclude that it affects POSTs, but not GETs? |
Also, the JSON example titled "REST API Version 1.3.0 and later - Payload Example 3 (available parameters):" in the version prior to my changes was already not working, right? If not, then I'm not going to reinstate that. I expect that this is a bug in the documentation: it should have shown only the first element of that 'users' array, instead of the entire array. |
I think I've now fixed this for all occurrences of |
I'm seeing working JSON, and the lovely custom errors when I do the wrong thing. 👍 👍 |
I've tested everything except the MUC permissions endpoints and the legacy UserService, and pushed one additional commit to add another annotation. |
Thy all for the great effort! |
This updates the Jersey dependency from 1.x to 2.x.
This commit requires OF-2352 / igniterealtime/Openfire#1945 which means that this PR will not work with 4.7.0 beta (but hopefully will with 4.7.0 non-beta).