Skip to content

Commit 5e7ee98

Browse files
Ashu96adrians5j
authored andcommitted
fix(api-headless-cms): add equality check for id idValidation
1 parent 613ccb8 commit 5e7ee98

File tree

1 file changed

+3
-0
lines changed
  • packages/api-headless-cms/src/content/plugins/models/ContentModel

1 file changed

+3
-0
lines changed

packages/api-headless-cms/src/content/plugins/models/ContentModel/idValidation.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@ export default async (value: string) => {
55
if (!value.charAt(0).match(/[a-zA-Z]/)) {
66
throw new Error(`Provided ID ${value} is not valid - must not start with a number.`);
77
}
8+
if (value.trim().toLowerCase() === "id") {
9+
throw new Error(`Provided ID ${value} is not valid - "id" is an auto-generated field.`);
10+
}
811
};

0 commit comments

Comments
 (0)