Skip to content

fix: accept JSON string json_schema in VariableEntity (lts/1.13.x) - #45497

Merged
41tair merged 1 commit into
lts/1.13.xfrom
fix/lts-1.13.x-json-schema-string
Nov 4, 2026
Merged

41tair merged 1 commit into
lts/1.13.xfrom
fix/lts-1.13.x-json-schema-string

Conversation

@zhangx1n

@zhangx1n zhangx1n commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Summary

Related #36766, ENG-1400. Follow-up to #45123.

The web editor stores the Start node json_schema as a JSON string. #45123 only normalizes it in WorkflowVariablesConfigManager.convert. StartNodeData still fails with json_schema Input should be a valid dictionary at runtime.

This ports langgenius/graphon#165 to dify_graph on lts/1.13.x. VariableEntity.json_schema now uses a mode="before" validator that parses JSON strings, treats empty strings as None, and rejects non-object values.

From Amp

Screenshots

N/A

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've verified the change and added or updated tests where meaningful regression risk justifies coverage.
  • I've updated the documentation accordingly.
  • I ran make lint && make type-check (backend) and vp staged (frontend) to appease the lint gods

@github-actions github-actions Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Nov 4, 2026
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 39.05% 39.06% +0.01%
Strict coverage 38.44% 38.45% +0.01%
Typed symbols 19,918 19,929 +11
Untyped symbols 31,583 31,583 0
Modules 2865 2866 +1

@zhangx1n
zhangx1n force-pushed the fix/lts-1.13.x-json-schema-string branch from c7bad58 to 952c8f2 Compare November 4, 2026 02:21
@codecov

codecov Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 26.66667% with 11 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (lts/1.13.x@351e604). Learn more about missing BASE report.

Files with missing lines Patch % Lines
api/dify_graph/variables/input_entities.py 26.66% 11 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             lts/1.13.x   #45497   +/-   ##
=============================================
  Coverage              ?   53.53%           
=============================================
  Files                 ?     1333           
  Lines                 ?   107405           
  Branches              ?    13298           
=============================================
  Hits                  ?    57497           
  Misses                ?    47730           
  Partials              ?     2178           
Flag Coverage Δ
api 53.53% <26.66%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@zhangx1n
zhangx1n marked this pull request as ready for review November 4, 2026 03:15
@zhangx1n
zhangx1n requested a review from a team November 4, 2026 03:15
@zhangx1n zhangx1n changed the title fix: accept JSON string json_schema in VariableEntity (lts/1.13.x) backport: accept JSON string json_schema in VariableEntity (lts/1.13.x) Nov 4, 2026
Port langgenius/graphon#165 (bfe73c1) to dify_graph on lts/1.13.x.
On main it landed via the graphon v0.5.1 upgrade (#37168).

(cherry picked from commit b4c50eb)
@zhangx1n
zhangx1n force-pushed the fix/lts-1.13.x-json-schema-string branch from 952c8f2 to a465545 Compare November 4, 2026 03:17
@zhangx1n zhangx1n changed the title backport: accept JSON string json_schema in VariableEntity (lts/1.13.x) fix: accept JSON string json_schema in VariableEntity (lts/1.13.x) Nov 4, 2026
@zhangx1n
zhangx1n requested a review from wylswz November 4, 2026 03:35
@zhangx1n

zhangx1n commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

@41tair
41tair merged commit 51524f4 into lts/1.13.x Nov 4, 2026
18 of 19 checks passed
@41tair
41tair deleted the fix/lts-1.13.x-json-schema-string branch November 4, 2026 06:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants