[eas-cli] Accept template expressions in workflow schema string formats - #4184
Open
giaBaoJS wants to merge 2 commits into
Open
[eas-cli] Accept template expressions in workflow schema string formats#4184giaBaoJS wants to merge 2 commits into
giaBaoJS wants to merge 2 commits into
Conversation
|
Subscribed to pull request
Generated by CodeMention Warning: The preamble and epilogue options in commentConfiguration are deprecated. Use template instead. |
`eas workflow:validate` checks the raw YAML against the workflow JSON schema
before template expressions are resolved, so a value like
`webhook_url: ${{ env.SLACK_WEBHOOK_URL }}` can never satisfy `format: uri`.
Relax string formats to accept template expressions for the workflow schema
only, leaving the store metadata schema strict.
giaBaoJS
force-pushed
the
fix/workflow-validate-template-formats
branch
from
August 18, 2026 15:07
6a71977 to
bc0c90e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Fixes #3404.
eas workflow:validaterejects a workflow that passes a template expression to a field the schema declares with a JSON Schemaformat. The reproduction from the issue:The schema served by
/v2/workflows/schemadeclareswebhook_urlas{ "type": "string", "format": "uri" }, andvalidateWorkflowStructureruns the raw parsed YAML through Ajv before any template expression is resolved.${{ env.SLACK_WEBHOOK_URL }}is not a URI, so the format check fails.Because
paramsis ananyOfof two shapes, that one format failure makes neither variant match, the job then matches none of the 18 job types, and the user is shown 44 errors that all point somewhere other than the real problem:The workflow itself is valid and runs fine — only the local pre-flight check rejects it.
I noticed this issue is assigned to @douglowder. This is offered as a ready-made option rather than an assumption that it is unowned — if there is a fix already in flight or a different approach you would prefer (for example, dropping
format: uriserver-side), please feel free to close this.How
validation.tsalready has precedent for this:buildProfileIsInterpolatedskips the build-profile existence check when the profile name is interpolated, for exactly the same reason. This applies the same rule to string formats.A new
commandUtils/workflow/templateExpressions.tsexports:containsTemplateExpression(value)— the shared${{ … }}check.buildProfileIsInterpolatednow delegates to it so there is a single definition.allowTemplateExpressionsInStringFormats(ajv)— re-registers every string format on an Ajv instance so that a value containing a template expression satisfies the format, while every other value is still checked by the original format function.validateWorkflowStructurecalls it on its own validator. Two deliberate choices:createValidator()insrc/metadata/utils/ajv.tsis shared with store metadata validation (src/metadata/config/validate.ts), whose schema usesuri,date-timeandemail. That module is not touched at all by this PR, so metadata validation keeps its strict format checks.uriis the only one, but a hardcoded list would silently stop covering any format the server adds later.The relaxation stays narrow: a value without a template expression is still checked by the original format, so
webhook_url: "not a url"is still rejected.ajv-formatsregisters formats in three different shapes (plain function, RegExp, and object withvalidate/compare), plus annotation-only formats registered astrue— each is handled separately so that no format silently ends up checking nothing.Test Plan
Two new suites, both offline — they feed a fixture schema through the
EXPO_TESTING_WORKFLOW_SCHEMA_PATHescape hatch thatfetchWorkflowSchemaAsyncalready supports.__tests__/validation-test.tsexercises the fullvalidateWorkflowFileAsyncpath against a trimmed copy of the realslackjob schema:__tests__/templateExpressions-test.tscovers the helper directly, with one case perajv-formatsshape so the relaxation cannot degenerate into accepting everything:Reverting only the
allowTemplateExpressionsInStringFormats(ajv)call and keeping the tests turns the two template cases red with the original error, while the malformed-literal case stays green in both states:I also ran the issue's workflow through
validateWorkflowFileAsyncagainst the live schema downloaded fromhttps://api.expo.dev/v2/workflows/schema: 44 errors before, validates cleanly after.cd packages/eas-cli && yarn jest: 283/285 suites, 2403 tests passing. The two failures (src/observe/__tests__/formatEvents.test.ts,src/observe/__tests__/formatCustomEvents.test.ts) are locale-dependent snapshot failures that also fail on a clean checkout ofmainon my machine, and are unrelated to this change.yarn jest src/metadatapasses 15/15 suites and 187 tests, unchanged.yarn typecheck,yarn lintandyarn fmt:checkare clean.