feat(core): add patch endpoint for partial update on properties - #142
feat(core): add patch endpoint for partial update on properties#142RVANDO12 wants to merge 2 commits into
Conversation
Code Coverage OverviewLanguages: Java Java / code-coverage/jacocoThe overall line coverage in commit 9dd7feb in the Show a line coverage summary of the most impacted files.
Updated |
There was a problem hiding this comment.
🟡 Changes recommended
The PATCH mapping/validation flow appears incompatible with “omit fields to preserve them” semantics (notably omitting name), and the main documented PATCH use-case isn’t currently enforced by the integration test as written.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds a new REST PATCH endpoint to partially update entities, aiming to preserve omitted fields while merging provided properties/relations into the existing entity state. This extends the Entities Management API and updates the documentation and test fixtures to support the new workflow.
Changes:
- Added
PATCH /api/v1/entities/{templateIdentifier}/{entityIdentifier}to the API controller, plus request DTO + mapper support. - Updated CORS configuration and OpenAPI (static swagger) to expose the new operation.
- Expanded integration tests and seeded test data to cover partial update scenarios.
File summaries
| File | Description |
|---|---|
| src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/controller/EntityController.java | Adds the new PATCH endpoint wiring into the domain service. |
| src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/dto/in/EntityPatchDtoIn.java | Introduces a request DTO for partial entity updates. |
| src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/mapper/entity/EntityDtoInMapper.java | Adds mapping from PATCH DTO to the domain model. |
| src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/configuration/SwaggerDescription.java | Adds Swagger strings for PATCH endpoint summary/description and schema description. |
| src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/configuration/SecurityConfiguration.java | Updates CORS allowed methods to include PATCH. |
| docs/src/static/swagger.yaml | Documents the PATCH operation and EntityPatchDtoIn schema in the published OpenAPI. |
| docs/src/concepts/entities.md | Documents how to use PATCH for partial updates. |
| src/test/java/com/decathlon/idp_core/infrastructure/adapters/api/controller/EntityControllerTest.java | Adds integration tests for PATCH behavior and adjusts search expectations. |
| src/test/java/com/decathlon/idp_core/infrastructure/adapters/api/mapper/entity/EntityDtoInMapperTest.java | Adds unit coverage for the new patch DTO mapping method. |
| src/test/java/com/decathlon/idp_core/infrastructure/adapters/api/controller/EntityTemplateControllerTest.java | Updates expected template counts due to the new patch-test template fixture. |
| src/test/resources/db/test/R__1_Insert_test_data.sql | Adds a minimal patch-test template and relation/property definitions for patch scenarios. |
| src/test/resources/db/test/R__2_Insert_entities_test_data.sql | Seeds an entity fixture (web-api-patch-1) used by PATCH integration tests. |
Review details
- Files reviewed: 12/12 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|



PR Description
What this PR Provides
PATCHendpoint (PATCH /api/v1/entities/{templateIdentifier}/{entityIdentifier}).Review
The reviewer must double-check these points:
How to test
Initial State
Ensure the
web-servicetemplate and entityweb-api-1exist inidp-backwith properties such asapplicationNameset tocatalog-apiandportset to8080.What and How to Test
Execute a
PATCHHTTP request against the entity resource updating only theportfield:Expected Results
200 OKwith the updatedEntityDtoOutschema.portis updated to"9090".applicationName) and relations remain unchanged.Breaking changes (if any)