Skip to content

Commit

Permalink
fix(api): Validate static data value for resource workflow (#3736)
Browse files Browse the repository at this point in the history
  • Loading branch information
RicardoE105 authored Jul 20, 2022
1 parent 994c89a commit 7ba9a05
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
11 changes: 11 additions & 0 deletions packages/cli/src/PublicApi/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,17 @@ function createApiRouter(
validate: (identifier: string) =>
validator.isUUID(identifier) || validator.isEmail(identifier),
},
{
name: 'jsonString',
validate: (data: string) => {
try {
JSON.parse(data);
return true;
} catch (e) {
return false;
}
},
},
],
validateSecurity: {
handlers: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,14 @@ properties:
settings:
$ref: './workflowSettings.yml'
staticData:
type: string
example: { lastId: 1 }
nullable: true
example: '{ iterationId: 2 }'
anyOf:
- type: string
format: 'jsonString'
nullable: true
- type: object
nullable: true
tags:
type: array
items:
Expand Down

0 comments on commit 7ba9a05

Please sign in to comment.