CLI-1822: Update specs for environment and sites service.#2015
CLI-1822: Update specs for environment and sites service.#2015deepakmishra2 wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request updates Acquia Cloud API specs and adjusts API command generation so CLI-created commands resolve servers correctly across both legacy specs (top-level servers) and newer specs (per-path servers), with added unit/functional test coverage to prevent regressions.
Changes:
- Update
ApiCommandHelper::generateApiCommandsFromSpec()to prefer per-pathservers, fall back to top-levelservers, and avoid callingsetServers()when no servers are defined. - Add PHPUnit coverage validating server-resolution behavior, including the “do not initialize servers when absent” case.
- Add a functional test covering
api:environments:trusted-proxiesrequest execution/output, and refresh vendored spec assets/version.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/Command/Api/ApiCommandHelper.php |
Updates server resolution logic for generated API commands (per-path preferred, top-level fallback, no-op when absent). |
tests/phpunit/src/Commands/Api/ApiCommandHelperTest.php |
Adds unit tests verifying server resolution and uninitialized-property behavior. |
tests/phpunit/src/Commands/Api/ApiCommandTest.php |
Adds functional test for api:environments:trusted-proxies GET behavior and JSON output. |
assets/acquia-spec.version |
Bumps pinned upstream spec commit reference. |
assets/acquia-spec.json |
Updates the vendored OpenAPI spec (including per-path servers and new trusted proxies endpoint). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2015 +/- ##
=========================================
Coverage 92.45% 92.45%
Complexity 1960 1960
=========================================
Files 123 123
Lines 7114 7115 +1
=========================================
+ Hits 6577 6578 +1
Misses 537 537 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Try the dev build for this PR: https://acquia-cli.s3.amazonaws.com/build/pr/2015/acli.phar |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This pull request improves how API commands handle server definitions from OpenAPI specs, ensuring compatibility with both new and old spec formats. It also adds comprehensive tests to verify this behavior and introduces a new functional test for the trusted proxies API command.
API Command Server Resolution Improvements:
generateApiCommandsFromSpecinApiCommandHelper.phpto prioritize per-pathserversover top-levelservers, and to avoid setting servers if neither is defined. This ensures correct handling for both new and legacy API spec formats.Testing Enhancements:
ApiCommandHelperTest.phpto verify:ReflectionPropertyimport to support property inspection in tests.Functional Command Test:
ApiCommandTest.phpto verify that theapi:environments:trusted-proxiescommand executes an HTTP GET request correctly and returns the expected JSON structure and status code.Version Update:
acquia-spec.versionfile to reference a new spec version, likely reflecting upstream API changes.**Quick smoke test **