Problem/Motivation
Currently, the module provides only three default status codes.
200 successful operation resp. 201 from openapi
400 Bad request
500 Internal server error
It is not possible to describe the own custom REST resources responses.
Proposed resolution
Add the possibility to describe the responses of custom REST resources.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | 3171530-11.patch | 5.02 KB | broon |
| #8 | 3171530-08-on-3116760-15.patch | 3.61 KB | grathbone |
| #8 | 3171530-08.patch | 3.46 KB | grathbone |
| #3 | response_description_functionality-3171530-3.patch | 4.05 KB | marco-s |
| #2 | response_description_functionality-3171530-2.patch | 4.35 KB | marco-s |
Comments
Comment #2
marco-sProposal: I added a new method to
RestGeneratorwhich checks for response information in the REST resources's plugin definition.This makes it possible to define the response info in the custom REST resources.
Example (in your REST resource class):
Theoretically, you could also define it in the RestResource annotation.
This is just a proposal. Maybe there is a better solution?!
Comment #3
marco-sI have updated the patch so that the developer has full control in the plugin definition method.
Example usage:
Comment #4
grathbone commentedPatch doesn't apply along with the patch #14 in 3116760, so wrote a patch of 530 that will allow both.
Comment #5
grathbone commentedUpdated patch from #4 to allow for comment #15 patch.
Comment #6
grathbone commentedResponses need to be based on their appropriate method. Updated patch to reflect passing in responses keyed by method.
As well, attached a patch to allow using the patch in ticket issue #3116760 as well
Comment #7
grathbone commentedAttached the wrong patch above for the #3116760 patch.
Comment #8
grathbone commentedResponses need to be based on their appropriate method. Updated patch to reflect passing in responses keyed by method.
Note: Messed up the patch in #06. So this is a fixed version with both patches.
Comment #9
grndlvl commentedRe-roll for latest 8.x-2.x. and as I see now the previous comment had two patches and 3171530-08.patch applied just fine. Sorry for the noise.
Comment #10
grndlvl commentedComment #11
broonThe patch from #9 works. However, we required to not only to be able to define the response but also the available parameters. Thus, we extended the patch to work similarly for parameters in the class annotation.
Comment #12
broonComment #13
broon