Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117,356 changes: 81,041 additions & 36,315 deletions assets/acquia-v3-spec.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions assets/acquia-v3-spec.version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
199d128f014624cedeed3a984d059ee7e064596f
9 changes: 3 additions & 6 deletions bin/acli
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,9 @@ $output = $container->get(OutputInterface::class);
$helper = $container->get(ApiCommandHelper::class);
$application->addCommands($helper->getApiCommands( __DIR__ . '/../assets/acquia-spec.json', 'api', $container->get(ApiCommandFactory::class)));
$application->addCommands($helper->getApiCommands( __DIR__ . '/../assets/acsf-spec.json', 'acsf', $container->get(AcsfCommandFactory::class)));
$acquiaV3Spec = __DIR__ . '/../assets/acquia-v3-spec.json';
if (file_exists($acquiaV3Spec)) {
/** @var ApiV3CommandHelper $v3Helper */
$v3Helper = $container->get(ApiV3CommandHelper::class);
$application->addCommands($v3Helper->getApiCommands($acquiaV3Spec, 'api:v3', $container->get(ApiV3CommandFactory::class)));
}
/** @var ApiV3CommandHelper $v3Helper */
$v3Helper = $container->get(ApiV3CommandHelper::class);
$application->addCommands($v3Helper->getApiCommands(__DIR__ . '/../assets/acquia-v3-spec.json', 'api:v3', $container->get(ApiV3CommandFactory::class)));
try {
/** @var SelfUpdateManager $selfUpdateManager*/
$selfUpdateManager = $container->get(SelfUpdateManager::class);
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
"npm install --prefix var/api-specs @redocly/cli@latest --no-save --ignore-scripts",
"cd var/api-specs && PATH=$(pwd)/node_modules/.bin:$PATH make bundle",
"cd var/api-specs && npx --yes @redocly/cli@latest bundle --config redocly.bundle.yaml dist/openapi.yaml --dereferenced --ext json -o ../../assets/acquia-v3-spec.json",
"git -C var/api-specs rev-parse HEAD > assets/acquia-v3-spec.version",
"rm -rf var/api-specs"
],
Comment thread
deepakmishra2 marked this conversation as resolved.
"update-acsf-api-spec": [
Expand Down
9 changes: 7 additions & 2 deletions src/Command/Api/ApiV3CommandHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,16 @@ protected function getSchemaStability(array $schema): ?string
}

/**
* Skip operations whose audience list is declared but does not include "public".
* Operations with no audience declared are included (assumed public by default).
* Skip operations that are explicitly disabled for the CLI channel, or whose
* audience list is declared but does not include "public".
* Missing enabled/audience fields default to included.
*/
protected function shouldSkipOperation(array $schema): bool
{
$cli = $schema['x-acquia-exposure']['channels']['cli'] ?? null;
if ($cli !== null && ($cli['enabled'] ?? true) === false) {
return true;
}
$audience = $schema['x-acquia-exposure']['audience'] ?? null;
if ($audience === null) {
return false;
Expand Down
31 changes: 31 additions & 0 deletions tests/phpunit/src/Commands/Api/ApiV3CommandHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,37 @@ public function testMissingAudienceIsIncluded(): void
$this->assertCount(1, $this->loadCommandsFromSpec($spec));
}

// channels.cli.enabled filtering tests.
public function testCliEnabledFalseIsSkipped(): void
{
$spec = $this->makeMinimalSpec([
'x-acquia-exposure' => [
'channels' => ['cli' => ['command' => 'sites:list', 'enabled' => false]],
],
]);
$this->assertCount(0, $this->loadCommandsFromSpec($spec));
}

public function testCliEnabledTrueIsIncluded(): void
{
$spec = $this->makeMinimalSpec([
'x-acquia-exposure' => [
'channels' => ['cli' => ['command' => 'sites:list', 'enabled' => true]],
],
]);
$this->assertCount(1, $this->loadCommandsFromSpec($spec));
}

public function testCliEnabledMissingDefaultsToIncluded(): void
{
$spec = $this->makeMinimalSpec([
'x-acquia-exposure' => [
'channels' => ['cli' => ['command' => 'sites:list']],
],
]);
$this->assertCount(1, $this->loadCommandsFromSpec($spec));
}

/**
* Kills the Continue_ mutation (continue→break) in the getSkippedApiCommands() check.
*
Expand Down
Loading