stable

Clone or download

Read-only

refacto: stop using the same representation for PUT and GET REST route

Part of story #36485 have custom services to /projects/:id/project_services Using the same representation as a return of REST GET route and as a parameter in another PUT REST route can lead to functional inconsistency (and some headaches). In the PUT route, only `is_enabled` key from the ServiceRepresentation is supported and the usage of others keys are ckecked. However, some keys in ServiceRepresentation has been added after and, the usage of new keys have not been checked in the `PUT` route (which should be a PATCH route btw). Even if it works in the end the "task fail successfully". This contribution intend to avoid future inconsistency by splitting the PUT representation and the GET representation. No functionnal change expected Change-Id: Ia7ebb64d99ab6af2ff42287f810c50be5a225f39

Modified Files

Name
M site-content/fr_FR/LC_MESSAGES/tuleap-core.po +0 −6 Go to diff View file
M site-content/pt_BR/LC_MESSAGES/tuleap-core.po +0 −6 Go to diff View file
A src/common/Project/REST/v1/Service/ServicePUTRepresentation.php +39 −0 Go to diff View file
A src/common/Project/REST/v1/Service/ServiceUpdateChecker.php +59 −0 Go to diff View file
M src/common/Project/REST/v1/ServiceRepresentation.php +18 −42 Go to diff View file
M src/common/Project/REST/v1/ServiceResource.php +7 −24 Go to diff View file
M src/common/Project/Service/ServicePOSTDataBuilder.php +1 −1 Go to diff View file
A src/common/Project/ServiceCanBeUpdated.php +34 −0 Go to diff View file
M src/common/Project/ServiceManager.class.php +2 −1 Go to diff View file
A tests/lib/Stubs/REST/v1/Service/ServiceCanBeUpdatedStub.php +55 −0 Go to diff View file
A tests/unit/common/Project/REST/v1/Service/ServiceUpdateCheckerTest.php +81 −0 Go to diff View file
M tests/unit/common/Project/REST/v1/ServiceRepresentationTest.php +2 −2 Go to diff View file
M tests/unit/common/Project/Service/ServicePOSTDataBuilderTest.php +8 −8 Go to diff View file