Skip to content

Fix dataset schema payload types and release v3.0.4#81

Merged
ar27111994 merged 2 commits intomainfrom
hotfix/v3.0.4
Apr 18, 2026
Merged

Fix dataset schema payload types and release v3.0.4#81
ar27111994 merged 2 commits intomainfrom
hotfix/v3.0.4

Conversation

@ar27111994
Copy link
Copy Markdown
Owner

@ar27111994 ar27111994 commented Apr 18, 2026

Summary

  • allow .actor/dataset_schema.json to accept object payloads for body and responseBody
  • add a regression test that validates both string and object payload shapes against the dataset schema
  • bump the project version to 3.0.4, sync generated actor metadata, and update the changelog

Verification

  • npm run validate:schemas
  • npm run test:jest -- tests/unit/actor/input_schema.test.js

Summary by CodeRabbit

Version 3.0.4 Release Notes

  • Bug Fixes

    • Enhanced dataset schema to accept webhook payloads in multiple formats: both parsed JSON objects and text strings can now be stored for request and response body fields.
  • Documentation

    • Updated changelog documenting schema enhancements and new regression test coverage.
  • Tests

    • Added regression tests validating webhook payload schema compatibility.

Copilot AI review requested due to automatic review settings April 18, 2026 11:09
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 18, 2026

Warning

Rate limit exceeded

@ar27111994 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 16 minutes and 36 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 16 minutes and 36 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e654b305-37eb-43a2-807a-eff921da29b7

📥 Commits

Reviewing files that changed from the base of the PR and between 08bbe46 and ff5994e.

📒 Files selected for processing (3)
  • .actor/dataset_schema.json
  • CHANGELOG.md
  • tests/unit/actor/input_schema.test.js
📝 Walkthrough

Walkthrough

Version number incremented from 3.0.3 to 3.0.4 across package metadata files. Dataset schema updated to accept body and responseBody fields as either string or object types. New regression test added to validate schema compatibility with webhook payloads. Changelog entry documenting fixes.

Changes

Cohort / File(s) Summary
Version Updates
.actor/actor.json, .actor/web_server_schema.json, package.json
Version fields bumped from 3.0.3 to 3.0.4 across actor specification, OpenAPI schema, and package metadata.
Schema Changes
.actor/dataset_schema.json
body and responseBody fields changed from string type to union type accepting both string and object; formatting adjustments to display properties configuration.
Documentation & Tests
CHANGELOG.md, tests/unit/actor/input_schema.test.js
Changelog entry added documenting schema relaxation for webhook payload persistence; new Jest test suite validates dataset schema compatibility with webhook objects using AJV validator.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

Review effort 1/5

Poem

🐰 A hop and a bump, version three-oh-four,
Where strings and objects dance forevermore,
Schemas relax to hold JSON's delight,
Tests now ensure the payloads ring right! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately reflects the main changes: fixing dataset schema payload types to accept objects and releasing version 3.0.4.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch hotfix/v3.0.4

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Actor’s dataset schema so logged webhook payload fields (body, responseBody) can be stored as structured JSON (not only strings), adds a regression test to keep the schema aligned, and bumps the release metadata to v3.0.4.

Changes:

  • Relax .actor/dataset_schema.json to accept object payloads for body and responseBody.
  • Add a Jest regression test validating both string and object payload shapes against the dataset schema.
  • Bump version to 3.0.4 and sync changelog + Actor/OpenAPI metadata.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/unit/actor/input_schema.test.js Adds Ajv-based regression validation for dataset schema payload shapes.
.actor/dataset_schema.json Expands body/responseBody types to include objects; reformats examples/view config.
package.json Bumps package version to 3.0.4.
package-lock.json Updates lockfile version fields to 3.0.4.
CHANGELOG.md Adds 3.0.4 entry describing the schema relaxation + test.
.actor/web_server_schema.json Syncs OpenAPI version/example strings to 3.0.4.
.actor/actor.json Syncs Actor metadata version to 3.0.4.

Comment thread tests/unit/actor/input_schema.test.js
Comment thread .actor/dataset_schema.json
Comment thread .actor/dataset_schema.json
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
tests/unit/actor/input_schema.test.js (1)

136-157: Strengthen the regression test with negative cases and broader shapes.

The current test only covers the happy path for string and object. Two small additions would make the regression meaningfully tighter:

  1. Assert a disallowed shape (e.g. body: 123 or body: true) fails validation — otherwise a future schema change that accidentally widens body to {} (any type) would silently pass.
  2. Cover real runtime outputs: body as an array (common for JSON-array webhooks) and responseBody: null (per LogDetailResponse.nullable: true in the web server schema) to surface the schema drift noted in .actor/dataset_schema.json.
🧪 Proposed additions
     expect(validate.errors).toBeNull();
+
+    // Negative case: scalar bodies should not validate under the current schema.
+    expect(validate({ body: 123 })).toBe(false);
+
+    // Real-world shapes captured by jsonParserMiddleware.
+    expect(validate({ body: [{ event: "x" }] })).toBe(true);
   });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/unit/actor/input_schema.test.js` around lines 136 - 157, Update the
unit test that compiles datasetSchema.fields (using Ajv/validate) to add
negative and broader positive cases: assert that invalid types for body (e.g.,
number or boolean like body: 123 or body: true) cause validate(...) to return
false and validate.errors to be non-null, and add additional positive cases such
as body as an array (e.g., []/[*]) and responseBody: null to ensure those
runtime shapes are accepted; locate the test block using describe("Apify dataset
schema") and the validate variable to insert these assertions.
.actor/dataset_schema.json (1)

60-74: Align body/responseBody types across both dataset and web server schemas.

The dataset schema (lines 60-74 and 117-131) accepts only string or object, but the web server schema accepts object, array, string, number, and boolean. Since jsonParserMiddleware can parse webhooks into any JSON type and Actor.pushData(event) in logger_middleware.js passes the parsed body directly, the dataset schema should include all possible JSON types to prevent validation failures and schema drift.

♻️ Proposed alignment
       "body": {
         "oneOf": [
-          {
-            "type": "string"
-          },
-          {
-            "type": "object"
-          }
+          { "type": "string" },
+          { "type": "object" },
+          { "type": "array" },
+          { "type": "number" },
+          { "type": "boolean" }
         ],

Apply the same to responseBody (lines 117-131).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.actor/dataset_schema.json around lines 60 - 74, The dataset schema's "body"
and "responseBody" definitions currently only allow "string" or "object", which
can fail when jsonParserMiddleware parses webhooks into other JSON types; update
the "oneOf" for both "body" and "responseBody" in .actor/dataset_schema.json to
match the web server schema by including "object", "array", "string", "number",
and "boolean" (i.e., add entries for type "array", type "number", and type
"boolean") so Actor.pushData(event) will validate all JSON payloads the
middleware can produce.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.actor/dataset_schema.json:
- Around line 60-74: The dataset schema's "body" and "responseBody" definitions
currently only allow "string" or "object", which can fail when
jsonParserMiddleware parses webhooks into other JSON types; update the "oneOf"
for both "body" and "responseBody" in .actor/dataset_schema.json to match the
web server schema by including "object", "array", "string", "number", and
"boolean" (i.e., add entries for type "array", type "number", and type
"boolean") so Actor.pushData(event) will validate all JSON payloads the
middleware can produce.

In `@tests/unit/actor/input_schema.test.js`:
- Around line 136-157: Update the unit test that compiles datasetSchema.fields
(using Ajv/validate) to add negative and broader positive cases: assert that
invalid types for body (e.g., number or boolean like body: 123 or body: true)
cause validate(...) to return false and validate.errors to be non-null, and add
additional positive cases such as body as an array (e.g., []/[*]) and
responseBody: null to ensure those runtime shapes are accepted; locate the test
block using describe("Apify dataset schema") and the validate variable to insert
these assertions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ed014e6a-0cb4-49ef-8e03-d0e8f04d7735

📥 Commits

Reviewing files that changed from the base of the PR and between 42c6e37 and 08bbe46.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (6)
  • .actor/actor.json
  • .actor/dataset_schema.json
  • .actor/web_server_schema.json
  • CHANGELOG.md
  • package.json
  • tests/unit/actor/input_schema.test.js

@ar27111994 ar27111994 merged commit cf723d8 into main Apr 18, 2026
18 checks passed
@ar27111994 ar27111994 deleted the hotfix/v3.0.4 branch April 18, 2026 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants