diff --git a/__test__/cli-test/content-types/with-asterisk.ts b/__test__/cli-test/content-types/with-asterisk.ts new file mode 100644 index 00000000..e3731568 --- /dev/null +++ b/__test__/cli-test/content-types/with-asterisk.ts @@ -0,0 +1,9 @@ +import { contentType } from '@optimizely/cms-sdk'; + +export const contentTypeWithRegexProperty = contentType({ + key: 'CT_with_asterisk', + baseType: '_page', + displayName: 'CT_with_asterisk', + properties: {}, + mayContainTypes: ['*'], +}); diff --git a/__test__/cli-test/package.json b/__test__/cli-test/package.json index c075a986..b8b266a0 100644 --- a/__test__/cli-test/package.json +++ b/__test__/cli-test/package.json @@ -5,7 +5,7 @@ "private": "true", "main": "index.js", "scripts": { - "test:manual": "echo \"Error: no test specified\" && exit 1" + "test:manual": "optimizely-cms-cli config push ./content-types.optimizely.config.mjs" }, "dependencies": { "@optimizely/cms-sdk": "workspace:*", diff --git a/packages/optimizely-cms-cli/src/utils/mapping.ts b/packages/optimizely-cms-cli/src/utils/mapping.ts index 3968236f..24c97fd5 100644 --- a/packages/optimizely-cms-cli/src/utils/mapping.ts +++ b/packages/optimizely-cms-cli/src/utils/mapping.ts @@ -25,8 +25,13 @@ export function parseChildContentType( const duplicates: string[] = []; const normalized = mayContainTypes.map((entry: any) => { const key = extractKeyName(entry, parentKey); - // Do not allow keys that start with '_' to be validated against allowedKeys - if (!key.startsWith('_') && allowedKeys && !allowedKeys.has(key)) { + if ( + key !== '*' && + // Do not allow keys that start with '_' to be validated against allowedKeys + !key.startsWith('_') && + allowedKeys && + !allowedKeys.has(key) + ) { invalid.push(key); } if (seen.has(key)) {