Skip to content

feat: add standard schema support for schemaTask#3058

Closed
Shaik-Sirajuddin wants to merge 2 commits intotriggerdotdev:mainfrom
Shaik-Sirajuddin:support_standard_schema
Closed

feat: add standard schema support for schemaTask#3058
Shaik-Sirajuddin wants to merge 2 commits intotriggerdotdev:mainfrom
Shaik-Sirajuddin:support_standard_schema

Conversation

@Shaik-Sirajuddin
Copy link

Closes #1642

✅ Checklist

  • I have followed every step in the contributing guide
  • The PR title follows the convention.
  • I ran and tested the code works

Testing

[Describe the steps you took to test this change]

  1. Create a schema with validate.js in hello-world
    validate.js is not natively supported by trigger.dev but implements standard-schema

  2. Pass it to schemaTask with a logging behaviour for task
    Example :

const citySchema = validate.object({
  city: validate.string,
});

export const logCityInfo = schemaTask({
  id: "json-schema-log-city-example",
  schema: citySchema,
  run: async (details, { ctx }) => {
    logger.info("City details", {
      name: details.city,
    });

    // Simulate
    await new Promise((resolve) => setTimeout(resolve, 1000));

    return {
      logged: true,
    };
  },
});

3.Run the json-schema-trigger-examples
4. call it inside triggerExamles once with valid type and perform another run with invalid type
Ex :

Invalid : 
 await logCityInfo.trigger({
      city: 12,
    });
Valid : 
 await logCityInfo.trigger({
      city: "name",
    });
  1. Verify an run logs in webapp

Changelog

Added support for standard schema

Screenshots

Code Example :
💯
Screenshot from 2026-02-14 12-48-23

Failed Validation :
Screenshot from 2026-02-14 12-47-42

@changeset-bot
Copy link

changeset-bot bot commented Feb 14, 2026

🦋 Changeset detected

Latest commit: 8609ffd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 28 packages
Name Type
@trigger.dev/core Major
@trigger.dev/build Major
trigger.dev Major
@trigger.dev/python Major
@trigger.dev/react-hooks Major
@trigger.dev/redis-worker Major
@trigger.dev/rsc Major
@trigger.dev/schema-to-json Major
@trigger.dev/sdk Major
@internal/cache Patch
@internal/clickhouse Patch
@internal/redis Patch
@internal/replication Patch
@internal/run-engine Patch
@internal/schedule-engine Patch
@internal/testcontainers Patch
@internal/tracing Patch
@internal/tsql Patch
@internal/zod-worker Patch
d3-chat Patch
references-d3-openai-agents Patch
references-nextjs-realtime Patch
references-realtime-hooks-test Patch
references-realtime-streams Patch
references-telemetry Patch
@internal/sdk-compat-tests Patch
@trigger.dev/database Major
@trigger.dev/otlp-importer Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

Hi @Shaik-Sirajuddin, thanks for your interest in contributing!

This project requires that pull request authors are vouched, and you are not in the list of vouched users.

This PR will be closed automatically. See https://github.com/triggerdotdev/trigger.dev/blob/main/CONTRIBUTING.md for more details.

@github-actions github-actions bot closed this Feb 14, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 14, 2026

Caution

Review failed

The pull request is closed.

Walkthrough

This PR adds support for the Standard Schema specification (v1) as a new validation library option for schemaTask. The changes include a new changeset documenting a major version bump, add the "@standard-schema/spec" dependency to the core package, export a new type guard function isSchemaStandardSchemaV1, and extend the schema validation logic to handle StandardSchemaV1 schemas alongside existing validators like Zod, Valibot, and ArkType.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1d744fa and 8609ffd.

📒 Files selected for processing (4)
  • .changeset/nine-snails-beam.md
  • packages/core/package.json
  • packages/core/src/v3/index.ts
  • packages/core/src/v3/types/schemas.ts

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


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

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 3 potential issues.

View 2 additional findings in Devin Review.

Open in Devin Review

Comment on lines 72 to +82
| SchemaMyZodEsque<TInput>
| SchemaScaleEsque<TInput>
| SchemaSuperstructEsque<TInput>
| SchemaYupEsque<TInput>;
| SchemaYupEsque<TInput>
| StandardSchemaV1<TInput>;

export type SchemaWithInputOutput<TInput, TParsedInput> =
| SchemaZodEsque<TInput, TParsedInput>
| SchemaValibotEsque<TInput, TParsedInput>
| SchemaArkTypeEsque<TInput, TParsedInput>;
| SchemaArkTypeEsque<TInput, TParsedInput>
| StandardSchemaV1<TInput, TParsedInput>;

Choose a reason for hiding this comment

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

🚩 StandardSchemaV1 added to both SchemaWithInputOutput and SchemaWithoutInput may cause ambiguous type inference

StandardSchemaV1<TInput, TParsedInput> is added to both SchemaWithInputOutput at line 82 and SchemaWithoutInput at line 76. The inferSchema type at line 86-98 first checks SchemaWithInputOutput then SchemaWithoutInput. Since StandardSchemaV1<TInput> (single type param) defaults Output = Input, it matches both unions.

This means TypeScript's conditional type resolution will always match SchemaWithInputOutput first for a StandardSchemaV1 schema, giving { in: TInput, out: TOutput }. The SchemaWithoutInput branch would only be reached if inference from SchemaWithInputOutput fails. In practice, StandardSchemaV1 carries its types via ~standard.types.input and ~standard.types.output, so the SchemaWithInputOutput match should infer correctly. However, the dual membership is redundant and could confuse contributors — the existing patterns (Zod, Valibot, ArkType) only appear in one union, not both.

(Refers to lines 70-82)

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@Shaik-Sirajuddin
Copy link
Author

PTAL @ericallam

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.

Adopt Standard Schema spec for schemaTask

1 participant

Comments