From b405bbf233f23988d0c21eed43fbe68ccad6f1be Mon Sep 17 00:00:00 2001 From: Kastriot Salihu Date: Wed, 19 Aug 2026 15:06:54 +0200 Subject: [PATCH] SP-2221: Omit --layers instead of defaulting it to SCHEMA config package validate defaulted --layers to ["SCHEMA"], so the out-of-the-box run reported schema problems only and said nothing about business rules, package settings or the semantic model. A user comparing the output against the Studio problems panel saw a much shorter list with no indication that four layers had not run. Omitting the option now sends no layers at all, which the validate API reads as every layer available for the team. An explicit list still narrows the run, and an empty one is dropped rather than sent, since the API rejects it. Includes-AI-Code: true --- docs/command-graph.html | 4 +-- docs/user-guide/config-commands.md | 8 ++--- .../package-validation.interfaces.ts | 2 +- .../configuration-management/module.ts | 6 ++-- .../package-validation.service.ts | 7 ++++- .../config-validate.spec.ts | 30 +++++++++++++++++++ 6 files changed, 45 insertions(+), 12 deletions(-) diff --git a/docs/command-graph.html b/docs/command-graph.html index 68fd253f..1cfad416 100644 --- a/docs/command-graph.html +++ b/docs/command-graph.html @@ -292,7 +292,7 @@ options: ["-p, --profile ", "--overwrite", "--validate (default: false)", "--gitProfile ", "--gitBranch ", "-f, --file ", "-d, --directory ", "-h, --help"] }, { id: "config_validate", label: "validate", group: "command", path: "config validate", description: "[Deprecated] Use 'config package validate' instead. Validate package node configurations.", - options: ["-p, --profile ", "--packageKey ", "--layers (SCHEMA, BUSINESS, PACKAGE_SETTINGS, PIG_SEMANTICS, DATA_PIPELINES; default: [\"SCHEMA\"])", "--nodeKeys (default: all nodes)", "--json", "-h, --help"] }, + options: ["-p, --profile ", "--packageKey ", "--layers (SCHEMA, BUSINESS, PACKAGE_SETTINGS, PIG_SEMANTICS, DATA_PIPELINES; default: every layer available for the team)", "--nodeKeys (default: all nodes)", "--json", "-h, --help"] }, { id: "config_diff", label: "diff", group: "command", path: "config diff", description: "[Deprecated] Use 't2tc package diff' instead. Diff a local Team-to-Team Copy archive against deployed or staging packages.", options: ["-p, --profile ", "--hasChanges", "--baseVersion (Compare against a given version or STAGING)", "--json", "-f, --file ", "-h, --help"] }, @@ -308,7 +308,7 @@ options: ["-p, --profile ", "--packageKey ", "--zip (default: false)", "--gitProfile ", "--gitBranch ", "-h, --help"] }, { id: "config_package_validate", label: "validate", group: "command", path: "config package validate", description: "Validate package node configurations", - options: ["-p, --profile ", "--packageKey ", "--layers (SCHEMA, BUSINESS, PACKAGE_SETTINGS, PIG_SEMANTICS, DATA_PIPELINES; default: [\"SCHEMA\"])", "--nodeKeys (default: all nodes)", "--json", "-h, --help"] }, + options: ["-p, --profile ", "--packageKey ", "--layers (SCHEMA, BUSINESS, PACKAGE_SETTINGS, PIG_SEMANTICS, DATA_PIPELINES; default: every layer available for the team)", "--nodeKeys (default: all nodes)", "--json", "-h, --help"] }, { id: "config_package_list", label: "list", group: "command", path: "config package list", description: "List packages in the target team. Lists staging packages by default.", options: ["-p, --profile ", "--json", "--flavors ", "-h, --help"] }, diff --git a/docs/user-guide/config-commands.md b/docs/user-guide/config-commands.md index 1d2bb6be..8bbea6ee 100644 --- a/docs/user-guide/config-commands.md +++ b/docs/user-guide/config-commands.md @@ -271,7 +271,7 @@ info: ERROR my-knowledge-model (SEMANTIC_MODEL) - $.requiredField: is mis ### Validation Layers -The `--layers` option selects which validation layers to run. Multiple layers can be passed and are executed in a single request; their findings are merged into one report. +The `--layers` option selects which validation layers to run. Multiple layers can be passed and are executed in a single request; their findings are merged into one report. Omit `--layers` to run every layer available for the team, which is what the Studio problems panel reports; pass an explicit list only to narrow the run. | Layer | What it checks | Owner | |---|---|---| @@ -281,12 +281,12 @@ The `--layers` option selects which validation layers to run. Multiple layers ca | `PIG_SEMANTICS` | Semantic-model validation delegated to the Process Intelligence Graph semantic-layer runtime (PIG-SL), surfacing the `list-problems` findings the live service reports for Knowledge Models. | Semantic layer (`cloud-semantic-layer`) | | `DATA_PIPELINES` | Validation delegated to the data-pipeline platform service for the package's data-integration assets. | Data pipeline service | -`SCHEMA`, `BUSINESS`, `PACKAGE_SETTINGS`, `PIG_SEMANTICS`, and `DATA_PIPELINES` are the layers accepted by the Pacman API. Other values are rejected with a `400 layers.unsupported` error. +`SCHEMA`, `BUSINESS`, `PACKAGE_SETTINGS`, `PIG_SEMANTICS`, and `DATA_PIPELINES` are the layers accepted by the Pacman API. Other values are rejected with a `400 layers.unsupported` error, and so is an empty `--layers`. -To run all layers: +To run all layers, omit the option: ```bash -content-cli config package validate --packageKey --layers SCHEMA BUSINESS PACKAGE_SETTINGS PIG_SEMANTICS DATA_PIPELINES +content-cli config package validate --packageKey ``` Use `PACKAGE_SETTINGS` when you need to verify that the package's own settings are usable in the destination team before continuing authoring or import work. It reports issues such as missing dependency versions, duplicate dependency or variable keys, blank variable keys/types, missing Studio data model assignments, and OCDM package-settings problems when the corresponding backend validation is enabled. diff --git a/src/commands/configuration-management/interfaces/package-validation.interfaces.ts b/src/commands/configuration-management/interfaces/package-validation.interfaces.ts index e6294489..d616b50e 100644 --- a/src/commands/configuration-management/interfaces/package-validation.interfaces.ts +++ b/src/commands/configuration-management/interfaces/package-validation.interfaces.ts @@ -1,5 +1,5 @@ export interface PackageValidationRequest { - layers: string[]; + layers?: string[]; nodeKeys?: string[]; } diff --git a/src/commands/configuration-management/module.ts b/src/commands/configuration-management/module.ts index f332f463..ebee45b5 100644 --- a/src/commands/configuration-management/module.ts +++ b/src/commands/configuration-management/module.ts @@ -177,8 +177,7 @@ class Module extends IModule { .requiredOption("--packageKey ", "Key of the package to validate") .option( "--layers ", - "Validation layers to run. Allowed values: SCHEMA, BUSINESS, PACKAGE_SETTINGS, PIG_SEMANTICS, DATA_PIPELINES (can be combined, e.g. --layers SCHEMA BUSINESS PACKAGE_SETTINGS PIG_SEMANTICS DATA_PIPELINES). Defaults to SCHEMA.", - ["SCHEMA"] + "Validation layers to run. Allowed values: SCHEMA, BUSINESS, PACKAGE_SETTINGS, PIG_SEMANTICS, DATA_PIPELINES (can be combined, e.g. --layers SCHEMA BUSINESS). Omit to run every layer available for the team." ) .option("--nodeKeys ", "Specific node keys to validate (default: all nodes)") .option("--json", "Return the response as a JSON file") @@ -196,8 +195,7 @@ class Module extends IModule { .requiredOption("--packageKey ", "Key of the package to validate") .option( "--layers ", - "Validation layers to run. Allowed values: SCHEMA, BUSINESS, PACKAGE_SETTINGS, PIG_SEMANTICS, DATA_PIPELINES (can be combined, e.g. --layers SCHEMA BUSINESS PACKAGE_SETTINGS PIG_SEMANTICS DATA_PIPELINES). Defaults to SCHEMA.", - ["SCHEMA"] + "Validation layers to run. Allowed values: SCHEMA, BUSINESS, PACKAGE_SETTINGS, PIG_SEMANTICS, DATA_PIPELINES (can be combined, e.g. --layers SCHEMA BUSINESS). Omit to run every layer available for the team." ) .option("--nodeKeys ", "Specific node keys to validate (default: all nodes)") .option("--json", "Return the response as a JSON file") diff --git a/src/commands/configuration-management/package-validation.service.ts b/src/commands/configuration-management/package-validation.service.ts index dad71b88..257dd462 100644 --- a/src/commands/configuration-management/package-validation.service.ts +++ b/src/commands/configuration-management/package-validation.service.ts @@ -16,7 +16,12 @@ export class PackageValidationService { } public async validatePackage(packageKey: string, layers: string[], nodeKeys: string[], jsonOutput: boolean): Promise { - const request: PackageValidationRequest = { layers }; + const request: PackageValidationRequest = {}; + // Omitted rather than defaulted here: the API reads an absent "layers" as every layer available for + // the team, and rejects an empty list. + if (layers && layers.length > 0) { + request.layers = layers; + } if (nodeKeys && nodeKeys.length > 0) { request.nodeKeys = nodeKeys; } diff --git a/tests/commands/configuration-management/config-validate.spec.ts b/tests/commands/configuration-management/config-validate.spec.ts index 49b4ea2c..469cf994 100644 --- a/tests/commands/configuration-management/config-validate.spec.ts +++ b/tests/commands/configuration-management/config-validate.spec.ts @@ -28,6 +28,36 @@ describe("Config validate", () => { expect(mockedPostRequestBodyByUrl.get(VALIDATE_URL)).toEqual(JSON.stringify({ layers: ["SCHEMA"] })); }) + it("Should omit layers from the request body when the option is not passed", async () => { + const response: SchemaValidationResponse = { + packageKey: "my-package", + valid: true, + summary: { errors: 0, warnings: 0, info: 0 }, + results: [] + }; + + mockAxiosPost(VALIDATE_URL, response); + + await new PackageValidationService(testContext).validatePackage("my-package", undefined, null, false); + + expect(mockedPostRequestBodyByUrl.get(VALIDATE_URL)).toEqual(JSON.stringify({})); + }) + + it("Should omit an empty layers list rather than send one the API rejects", async () => { + const response: SchemaValidationResponse = { + packageKey: "my-package", + valid: true, + summary: { errors: 0, warnings: 0, info: 0 }, + results: [] + }; + + mockAxiosPost(VALIDATE_URL, response); + + await new PackageValidationService(testContext).validatePackage("my-package", [], ["node-1"], false); + + expect(mockedPostRequestBodyByUrl.get(VALIDATE_URL)).toEqual(JSON.stringify({ nodeKeys: ["node-1"] })); + }) + it("Should include nodeKeys in request body when specified", async () => { const response: SchemaValidationResponse = { packageKey: "my-package",