XML & JSON Validation

Bundled schemas for SFCC import and export XML, form definitions, hooks.json, steptypes.json, caches.json and Page Designer JSON

Intellij SFCC teaches the IDE the file formats SFCC uses. Import and export XML, form definitions and the JSON files of a cartridge are validated while you type, with completion for elements, attributes and keys and a red mark on anything the platform would reject. The XML schemas are bundled with the plugin, so validation works offline

In hooks.json the name value offers the platform's 311 built-in hook points

Import and export XML

The plugin registers 53 SFCC schemas. A file is validated when its root element declares the matching SFCC namespace, the same way Business Manager exports it

catalog.xml
<?xml version="1.0" encoding="UTF-8"?>
<catalog xmlns="http://www.demandware.com/xml/impex/catalog/2006-10-31" catalog-id="storefront-catalog">
    <category category-id="mens">
        <display-name xml:lang="x-default">Mens</display-name>
        <online-flag>true</online-flag>
    </category>
</catalog>

With the namespace in place you get completion for every element and attribute and errors for missing, misplaced or misspelled items

AreaSchemas
Catalog and searchcatalog, pricebook, inventory, priceadjustmentlimits, productlist, search, search2, sort, store
Marketingpromotion, coupon, couponredemption, sourcecode, abtest, abtestparticipants, slot, giftcertificate, assignment
Customerscustomer, customergroup, customerlist, customerlist2, customerpaymentinstrument, customeractivedata, customercdnsettings
Orders and checkoutorder, returnimportfeed, shippingorderupdatefeed, paymentmethod, paymentprocessor, shipping, tax
Site and configurationsite, preferences, metadata, customobject, jobs, schedules, services, urlrules, redirecturl, cachesettings, csrfwhitelists, locales, geolocation, sitemapconfiguration, pagemetatag, oauth, feed
Contentlibrary
Cartridge codeform, bmext, dcext

Each schema is registered for one namespace version, for example catalog/2006-10-31 or jobs/2015-07-01

Form definitions

Form XML in a forms folder, with the namespace http://www.demandware.com/xml/form/2008-04-19, is validated against form.xsd. On top of the schema the plugin adds:

  • Completion and navigation for resource keys in label, description, range-error, value-error, missing-error and parse-error, taken from your forms resource bundles
  • Completion of form names in the name attribute of an <include>, and a gutter icon that opens the included form. With Global scope the icon lists the form in every cartridge, with a site selected it opens the one that comes first in that site's cartridge path
  • Highlighting of numbers in min-length and max-length and of keywords in type, mandatory and valid-form

How scripts and templates reach these forms, for example server.forms.getForm('billing'), is covered in SFCC Contracts

Cartridge JSON files

These files get a schema from the plugin, picked by file name. The schema name shows in the JSON schema widget of the status bar

FileSchemaAlso
hooks.jsonSalesforce B2C Hooksname completes the platform's 311 hook points, labeled by group such as Request Hooks, Order Hooks, Calculate Hooks, Payment Hooks, Shop Hooks and SCAPI Hooks. script completes script paths and has a gutter icon to the script
steptypes.jsonSalesforce B2C Steptypesmodule completes script paths and has a gutter icon to the job step script
caches.jsonSalesforce B2C CachesValidates the custom cache definitions
package.jsonhooks and caches complete JSON file paths and have a gutter icon that opens the file
cartridge/hooks.json
{
    "hooks": [
        {
            "name": "dw.order.calculate",
            "script": "./scripts/hooks/cart/calculate.js"
        }
    ]
}

Click the gutter icon (Navigate to file) next to script to open the script. Calls such as HookMgr.callHook('app.payment.processor.basic_credit', ...) resolve to the same hooks.json entries, see SFCC Contracts

Page Designer JSON

Meta definition files of Page Designer get their own schema by folder

FolderSchema
experience/pagesSalesforce B2C Page Designer - Pages
experience/componentsSalesforce B2C Page Designer - Components
experience/aspectsSalesforce B2C Page Designer - Aspects
experience/editorsSalesforce B2C Page Designer - Editors

Unlike the XML schemas, these four are downloaded by the IDE the first time you open such a file. References between Page Designer files, such as a custom editor's type or its scripts, navigate with Cmd+Click (Ctrl+Click), and the resource paths of custom editors complete the cartridge's static CSS and JavaScript files

Troubleshooting

SymptomWhat to do
An XML file isn't validatedCheck that the root element declares an SFCC namespace from the table, spelled exactly as Business Manager exports it
"URI is not registered" on the namespaceThe file uses a namespace version the plugin doesn't register. Use the version from a current Business Manager export
A Page Designer file has no schemaThe IDE couldn't download it. Check your network and that remote JSON schemas are allowed in Settings › Languages & Frameworks › Schemas and DTDs › Remote JSON Schemas
hooks.json has no hook name completionThe file must be named exactly hooks.json, and its cartridge must be linked
The wrong schema is applied to a JSON filePick the schema in the JSON schema widget of the status bar, or check the file name

On this page