Skip to content

Commit 62acd3d

Browse files
authored
Merge pull request #1362 from contentstack/bugfix/CS-44364
CS-44364- Fixed the issue where the reference was coming in as string
2 parents a8de573 + 6b4b775 commit 62acd3d

6 files changed

Lines changed: 21 additions & 11 deletions

File tree

package-lock.json

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/contentstack-audit/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@contentstack/cli-audit",
3-
"version": "1.5.1",
3+
"version": "1.5.2",
44
"description": "Contentstack audit plugin",
55
"author": "Contentstack CLI",
66
"homepage": "https://github.com/contentstack/cli",

packages/contentstack-audit/src/modules/entries.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,11 @@ export default class Entries {
301301
fieldStructure: ReferenceFieldDataType,
302302
field: EntryReferenceFieldDataType[],
303303
) {
304+
if (typeof field === 'string') {
305+
let stringReference = field as string;
306+
stringReference = stringReference.replace(/'/g, '"');
307+
field = JSON.parse(stringReference);
308+
}
304309
return this.validateReferenceValues(tree, fieldStructure, field);
305310
}
306311

@@ -826,6 +831,11 @@ export default class Entries {
826831
entry: EntryReferenceFieldDataType[],
827832
) {
828833
const missingRefs: Record<string, any>[] = [];
834+
if (typeof entry === 'string') {
835+
let stringReference = entry as string;
836+
stringReference = stringReference.replace(/'/g, '"');
837+
entry = JSON.parse(stringReference);
838+
}
829839
entry = entry
830840
?.map((reference) => {
831841
const { uid } = reference;

packages/contentstack-import/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"author": "Contentstack",
66
"bugs": "https://github.com/contentstack/cli/issues",
77
"dependencies": {
8-
"@contentstack/cli-audit": "~1.5.1",
8+
"@contentstack/cli-audit": "~1.5.2",
99
"@contentstack/cli-command": "~1.2.16",
1010
"@contentstack/cli-utilities": "~1.6.0",
1111
"@contentstack/management": "~1.15.3",

packages/contentstack/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@contentstack/cli",
33
"description": "Command-line tool (CLI) to interact with Contentstack",
4-
"version": "1.17.0",
4+
"version": "1.17.1",
55
"author": "Contentstack",
66
"bin": {
77
"csdx": "./bin/run"
@@ -22,7 +22,7 @@
2222
"prepack": "pnpm compile && oclif manifest && oclif readme"
2323
},
2424
"dependencies": {
25-
"@contentstack/cli-audit": "~1.5.1",
25+
"@contentstack/cli-audit": "~1.5.2",
2626
"@contentstack/cli-auth": "~1.3.17",
2727
"@contentstack/cli-cm-bootstrap": "~1.9.0",
2828
"@contentstack/cli-cm-branches": "~1.0.24",

pnpm-lock.yaml

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)