Skip to content

Commit

Permalink
Make validation stricter for HTTP response metadata properties
Browse files Browse the repository at this point in the history
  • Loading branch information
krasun committed Aug 1, 2024
1 parent 09e7328 commit 23b6f1d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "screenshotone-validations",
"homepage": "https://screenshotone.com",
"version": "1.0.38",
"version": "1.0.39",
"description": "Validation schemes for the ScreenshotOne API requests.",
"repository": {
"type": "git",
Expand Down
14 changes: 12 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,18 @@ const screenshotScheme = {
metadata_content: Joi.boolean().default(false),
metadata_page_title: Joi.boolean().default(false),
metadata_open_graph: Joi.boolean().default(false),
metadata_http_response_status_code: Joi.boolean().default(false),
metadata_http_response_headers: Joi.boolean().default(false),
metadata_http_response_status_code: Joi.boolean()
.default(false)
.when("url", {
is: Joi.exist(),
then: Joi.boolean(),
otherwise: Joi.forbidden(),
}),
metadata_http_response_headers: Joi.boolean().default(false).when("url", {
is: Joi.exist(),
then: Joi.boolean(),
otherwise: Joi.forbidden(),
}),

clip_x: Joi.number().integer().optional(),
clip_y: Joi.number().integer().optional(),
Expand Down

0 comments on commit 23b6f1d

Please sign in to comment.