Skip to content
Draft
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
10 changes: 10 additions & 0 deletions .changeset/vs-extension-xml-validation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'b2c-vs-extension': minor
'@salesforce/b2c-dx-docs': patch
---

Add XSD-based validation for B2C metadata XML files. The extension now contributes 48 schemas (catalogs, promotions, jobs, services, customer feeds, A/B tests, page-meta-tags, sorting rules, source codes, content libraries, and more) so opening a B2C metadata XML produces inline diagnostics, autocomplete, and hover documentation.

**File-glob coverage** spans both common workspace conventions: the canonical SFCC site-archive layout (`sites/<id>/promotions.xml`, `catalogs/<id>/catalog.xml`, …) and exploded-archive workspaces under a `metadata/` folder (`metadata/promotions/*.xml`, `metadata/catalogs/*.xml`, …).

**New install requirement:** the extension declares `redhat.vscode-xml` as an extension dependency. VS Code installs it automatically the first time this extension activates after the upgrade. Users / teams whose policies block third-party extensions should disable `b2c-dx.features.xmlValidation` (or remove the dependency declaration) before deploying the upgrade.
21 changes: 21 additions & 0 deletions docs/vscode-extension/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,27 @@ The B2C Script Debugger registers regardless of these toggles — it activates o
| `b2c-dx.sandbox.pollingInterval` | `10` | Seconds between polls while a sandbox is in a transitional state (`creating`, `starting`, `stopping`, `deleting`, `cloning`). Range: 2–300. Polling stops automatically once the realm settles. |
| `b2c-dx.telemetry.enabled` | `true` | Send anonymous usage telemetry. Honors VS Code's `telemetry.telemetryLevel` — disabling that disables this regardless of this setting. |

### XML schema validation

The extension contributes XSD-based validation for B2C metadata XML files via the [Red Hat XML extension](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-xml), which is declared as an extension dependency and installed automatically. When a file path matches one of the contributed globs, diagnostics, autocomplete, and hover docs are driven by the corresponding B2C schema.

Both common workspace conventions are recognized:

- **Canonical site-archive layout** — `sites/<site-id>/`, `catalogs/<id>/`, `libraries/<id>/`, `customer_lists/<id>/`, `pricebooks/`, `inventory_lists/`, `meta/`.
- **Exploded `metadata/` workspace layout** — `metadata/sites/<id>/*.xml`, `metadata/catalogs/*.xml`, `metadata/promotions/*.xml`, etc.

Schemas covered include catalog, promotion, slot, customer-group, customer-list, custom-object, inventory, library, payment-method, payment-processor, preference, pricebook, redirect-url, search/search2, shipping, site, sourcecode, store, url-rule, jobs, services, schedules, ab-test (and participants), assignment, cache-settings, commerce-feature-state, coupon (and redemption), csrf-allowlist, customer, customer-cdn-settings, dcext, form, geolocation, gift-certificate, locales, meta (system/custom-objecttype-extensions), oauth-providers, page-meta-tags, price-adjustment-limits, product-list, sitemap-configuration, sorting-rules, storefronts, and tax. The full mapping is at `packages/b2c-vs-extension/resources/xsd-mappings.json`.

To disable XML validation globally in your workspace, set:

```jsonc
{
"xml.validation.enabled": false
}
```

To opt out of the Red Hat XML dependency entirely, uninstall this extension or pin to a release prior to the one that introduced XML validation.

### Complete defaults (copy-paste)

```jsonc
Expand Down
1 change: 1 addition & 0 deletions packages/b2c-vs-extension/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ node_modules
.vsce-stage/
*.vsix
/coverage
resources/xsd/
Loading