Skip to main content

CLI tool- New schema validation option

Release date: 19th March 2025

The CLI tool now gives you greater flexibility for migrating content, with a new "Ignore schema validation" feature. With this feature you can quickly migrate content items, bypassing schema validation that may prevent content migration.

The "Ignore schema validation" feature is designed for use with environments where users are not actively creating and updating production content. For example, it allows you to copy, move and import content items for your testing and QA environments, where schema validation isn't necessary.

Setting hubs to ignore schema validation
Link copied!

Schema validation is performed by default when you use the CLI tool to migrate content items.

You can choose the hubs for which the CLI tool is allowed to ignore validation, from the Dynamic Content "Properties" settings.

The Ignore schema validation hub setting

To help guard against developers using the –-ignoreSchemaValidation flag inadvertently, the "Ignore schema validation" setting on hubs must be set by a user with either the organization admin or hub admin role.

Once the hub level validation option is set, developers can choose whether to ignore validation when using the CLI tool.

Ignoring schema validation when migrating content
Link copied!

To ignore schema validation when migrating content items, developers need to:

  1. Ensure the destination hub to set to ignore schema validation.
  2. Use the –-ignoreSchemaValidation flag with the following content item commands:
    • Import
    • Copy
    • Move
    • Archive
    • Unarchive
tip

You can also use the –-ignoreSchemaValidation flag when cleaning and cloning hubs.

Here's an example, of how "ignore schema validation" works. In the schema snippet shown below, we have two properties, headline and strapline:

{
"type": "object",
"properties": {
"headline": { "type": "string" },
"strapline": { "type": "string" }
},
}

In this example you want to import content items created from this content type schema to a new hub. That hub has a different version of the content type schema, where the properties are both required fields:

{
"type": "object",
"properties": {
"headline": { "type": "string" },
"strapline": { "type": "string" }
},
"required": ["headline", "strapline"]
}

The CLI will detect if the content you are trying to migrate doesn't meet the destination schema validation and will not import the content, unless you use the --ignoreSchemaValidation flag to bypass the validation of the properties, for example:


dc-cli content-item copy --srcFolder <srcfolderId> --dstFolder <dstfolderId> --dstHubId <dstHubId> --facet schema:https://schema-examples.com/tutorial-banner --ignoreSchemaValidation

Using the --ignoreSchemaValidation flag will allow the content to be imported. The content items can be opened in the Dynamic Content authoring experience, and where possible the authoring experience will highlight where content values don't pass validation. With this example, any migrated content items with values missing for the headline and strapline properties, can be opened and their values populated.

Scope of the ignore validation flag

The --ignoreSchemaValidation flag only applies to the body of the content, and some additional validation will always be done that can cause content items to fail to be imported. See Scope of the ignore validation flag.

Ignoring schema validation

Cleaning and cloning hubs

Copy, move, import and export with the CLI tool