Skip to content

fix: accept unresolved references in schema_validation#9496

Open
ameyypawar wants to merge 1 commit into
windmill-labs:mainfrom
ameyypawar:fix/schema-validation-unresolved-references
Open

fix: accept unresolved references in schema_validation#9496
ameyypawar wants to merge 1 commit into
windmill-labs:mainfrom
ameyypawar:fix/schema-validation-unresolved-references

Conversation

@ameyypawar

@ameyypawar ameyypawar commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Summary

When a script enables // schema_validation and has a parameter typed as a resource (or any object), executing it with that parameter supplied as a Windmill reference fails:

Argument `gmail` should be an object

Schema validation runs before the worker resolves references, so a $res:… (or $var:/$jsonvar:/$encrypted:) reference is still a string at validation time and is rejected by the object rule.

Changes

  • windmill-common/src/schema.rs: SchemaValidationRule::apply_rule now short-circuits when the value is an unresolved reference string ($var:/$jsonvar:/$res:/$encrypted: — the prefixes the worker resolves), accepting it regardless of the declared type. The worker resolves the reference to its real value after validation runs.
  • Add a regression test (validate_accepts_unresolved_reference_for_object_param) covering all four reference prefixes, a genuine object (still validates), and a plain non-reference string (still rejected).

Test plan

  • cargo test -p windmill-common validate_accepts_unresolved_reference_for_object_param
  • Deploy the issue's repro (a // schema_validation script with a resource parameter) and run it with the resource selected; confirm no "should be an object" error.

Fixes #6938


Summary by cubic

Allow unresolved Windmill references during schema validation so object/resource params passed as $res:/$var:/$jsonvar:/$encrypted: no longer fail with "should be an object". The worker resolves these after validation. Fixes #6938.

  • Bug Fixes
    • Short-circuit SchemaValidationRule::apply_rule to accept $var:, $jsonvar:, $res:, $encrypted: strings for any declared type.
    • Added a regression test covering all four prefixes, a valid object, and rejecting a plain non-reference string.

Written for commit 5752869. Summary will update on new commits.

Review in cubic

When a script enables `// schema_validation` and has a parameter typed as a
resource (or any object), running it with that parameter supplied as a
Windmill reference failed with `Argument XX should be an object`.

Schema validation runs before the worker resolves references, so a `$res:`
(or `$var:`/`$jsonvar:`/`$encrypted:`) reference is still a string at
validation time and was rejected by the object rule. Short-circuit
`apply_rule` to accept unresolved reference strings regardless of the declared
type; the worker resolves them to their real value after validation.

Fixes windmill-labs#6938

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 1 file

Re-trigger cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 1 file

Re-trigger cubic

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.

bug: schema validation fails if resources used

1 participant