fix: prevent jsonPath method from being serialized in schema output#125
Merged
fix: prevent jsonPath method from being serialized in schema output#125
Conversation
When isTypeValidator() returns false due to cross-module Symbol issues, getColumnJsonPath() fell through to check `column.jsonPath !== undefined`. Since validators have a jsonPath method, this returned the function itself, which got stringified in the generated .datasource files. Fix: check `typeof column.jsonPath === "string"` instead. Bumps version to 0.0.59. Fixes #124 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Collaborator
Author
|
I found out that this issue showed up because I had an older version installed globally (0.46) and the latest one installed locally (0.58), so an incompatibility between 0.58 and the tinybird client in 0.46 caused this. |
rmorehig
approved these changes
Mar 7, 2026
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.
Summary
Fixes #124
When running
tinybird build, generated.datasourcefiles contained the entirejsonPathmethod body instead of proper JSON path values:Root Cause
In
getColumnJsonPath()atsrc/schema/datasource.ts, whenisTypeValidator(column)returnsfalse(which can happen due to cross-module Symbol issues between the CLI's SDK and the user's installed SDK), the code fell through to check:Since TypeValidator objects have a
jsonPathmethod, this condition was truthy, causing the function itself to be returned. When interpolated in a template literal during schema generation, the function's.toString()was called, producing the function body in the output.Fix
Changed the check to verify
jsonPathis actually a string value:This ensures we only return
jsonPathwhen it's a valid string path, not when it's a function reference.Test Plan
getColumnJsonPathnever returns a function🤖 Generated with Claude Code