Skip to content
Merged
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
9 changes: 9 additions & 0 deletions __test__/cli-test/content-types/with-asterisk.ts
Original file line number Diff line number Diff line change
@@ -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: ['*'],
});
2 changes: 1 addition & 1 deletion __test__/cli-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:*",
Expand Down
9 changes: 7 additions & 2 deletions packages/optimizely-cms-cli/src/utils/mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down