Skip to content

Commit

Permalink
fix: restrict allowed characters of layout item keys
Browse files Browse the repository at this point in the history
  • Loading branch information
GeekyEggo committed Feb 1, 2024
1 parent 85b512e commit b877cb0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions schemas/layout.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@
"key": {
"type": "string",
"description": "Unique name used to identify the layout item. When calling `setFeedback` this value should be used as the key as part of the object that represents the feedback.",
"pattern": "^[A-Za-z0-9\\-_]+$",
"errorMessage": "String must only contain alphanumeric characters (A-z, 0-9), hyphens (-), and underscores (_)",
"markdownDescription": "Unique name used to identify the layout item. When calling `setFeedback` this value should be used as the key as part of the object that represents the feedback."
},
"rect": {
Expand Down Expand Up @@ -299,6 +301,8 @@
"key": {
"type": "string",
"description": "Unique name used to identify the layout item. When calling `setFeedback` this value should be used as the key as part of the object that represents the feedback.",
"pattern": "^[A-Za-z0-9\\-_]+$",
"errorMessage": "String must only contain alphanumeric characters (A-z, 0-9), hyphens (-), and underscores (_)",
"markdownDescription": "Unique name used to identify the layout item. When calling `setFeedback` this value should be used as the key as part of the object that represents the feedback."
},
"rect": {
Expand Down Expand Up @@ -479,6 +483,8 @@
"key": {
"type": "string",
"description": "Unique name used to identify the layout item. When calling `setFeedback` this value should be used as the key as part of the object that represents the feedback.",
"pattern": "^[A-Za-z0-9\\-_]+$",
"errorMessage": "String must only contain alphanumeric characters (A-z, 0-9), hyphens (-), and underscores (_)",
"markdownDescription": "Unique name used to identify the layout item. When calling `setFeedback` this value should be used as the key as part of the object that represents the feedback."
},
"rect": {
Expand Down Expand Up @@ -584,6 +590,8 @@
"key": {
"type": "string",
"description": "Unique name used to identify the layout item. When calling `setFeedback` this value should be used as the key as part of the object that represents the feedback.",
"pattern": "^[A-Za-z0-9\\-_]+$",
"errorMessage": "String must only contain alphanumeric characters (A-z, 0-9), hyphens (-), and underscores (_)",
"markdownDescription": "Unique name used to identify the layout item. When calling `setFeedback` this value should be used as the key as part of the object that represents the feedback."
},
"rect": {
Expand Down
4 changes: 4 additions & 0 deletions src/api/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ export type Layout = {
type LayoutItemDefinition<TType extends string, TItem> = TItem & {
/**
* Unique name used to identify the layout item. When calling `setFeedback` this value should be used as the key as part of the object that represents the feedback.
* @pattern
* ^[A-Za-z0-9\-_]+$
* @errorMessage
* String must only contain alphanumeric characters (A-z, 0-9), hyphens (-), and underscores (_)
*/
key: string;

Expand Down

0 comments on commit b877cb0

Please sign in to comment.