-
Notifications
You must be signed in to change notification settings - Fork 2
feat: add capabilities proxy #408
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #408 +/- ##
============================================
+ Coverage 94.91% 94.95% +0.03%
- Complexity 2032 2048 +16
============================================
Files 359 363 +4
Lines 6642 6694 +52
============================================
+ Hits 6304 6356 +52
Misses 338 338 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Pull request overview
This pull request adds a capabilities proxy endpoint to enable communication with the Capabilities API service. The implementation follows the same pattern as the existing addresses microservice proxy.
Changes:
- Added new CapabilitiesApiService to handle API communication with the capabilities service
- Created CapabilitiesAction with CORS support for handling frontend requests
- Registered the new proxy endpoint in the frontend context configuration
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/Api/Service/CapabilitiesApiService.php | New API service for communicating with the Capabilities API, handles authentication and base URL configuration |
| src/App/Action/Capabilities/CapabilitiesAction.php | New action handler with CORS support for proxying requests to the capabilities service |
| src/App/Request/Capabilities/CapabilitiesEndpointRequest.php | Request class defining the 'capabilities' property for the endpoint |
| src/Api/Response/CapabilitiesResponse.php | Response wrapper for capabilities API responses |
| src/Api/PdkCapabilitiesActions.php | Constants class defining the PROXY_CAPABILITIES action |
| config/pdk-services.php | Registers the CapabilitiesApiService in the DI container |
| config/pdk-default.php | Adds capabilitiesServiceUrl configuration with default value |
| config/actions.php | Registers the proxyCapabilities action in the frontend context and adjusts formatting for alignment |
| tests/Unit/App/Action/Capabilities/CapabilitiesActionTest.php | Comprehensive test coverage including request building, CORS handling, and OPTIONS preflight |
| tests/snapshots/ContextServiceTest__it_gets_context_data_with_data_set_delivery_options_config__1.json | Updated snapshot to include the new proxyCapabilities endpoint configuration |
| tests/snapshots/FrontendRenderServiceTest__it_renders_component_with_data_set_delivery_options__1.json | Updated snapshot to include the new proxyCapabilities endpoint configuration |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
61d2a3f to
dd7dbfa
Compare
| } | ||
|
|
||
| /** @var \MyParcelNL\Pdk\Api\Response\CapabilitiesResponse $response */ | ||
| $response = $this->apiService->doRequest($this->buildRequest($request), CapabilitiesResponse::class); |
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.
Here the SDK capabilities client needs to be used rather than internal PDK API logic (see acceptance criteria)
| */ | ||
| public function buildRequest(Request $incomingRequest): ApiRequest | ||
| { | ||
| $query = $incomingRequest->query->all(); |
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.
This is not the correct way to call capabilities - but using the SDK for this should make it redundant
INT-1269