fix: serialize dict fields as JSON strings in Superset API payloads - #2
Open
alionar wants to merge 1 commit into
Open
fix: serialize dict fields as JSON strings in Superset API payloads#2alionar wants to merge 1 commit into
alionar wants to merge 1 commit into
Conversation
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
mcp_superset/client.pysendsparams,json_metadata, andposition_jsonto Superset as Python dicts. Those fields require JSON-encoded strings, so every chart and dashboard create/update returns HTTP 400"Not a valid string.".Fixes
create_chart/update_chart:json.dumps(params)before sending. The reported bug.create_dashboard/update_dashboard: same forjson_metadataandposition_json.add_chart_to_dashboard: Superset returnsposition_jsonas a string. The oldisinstance(x, dict)check fails for every real dashboard and resets the layout to{}, which would wipe the dashboard on the next add. New code parses, mutates, re-serializes.update_dashboard_filters:/api/v1/dashboard/{id}/filtersdoes not exist on 4.x and uses a different shape on 6.x ({deleted, modified, reordered}). I rewrote this throughjson_metadatavia the main dashboardPUT, which works on every version.Test plan
superset_create_chart. Before: 400. After: new chart id.superset_add_chart_to_dashboardtwice: second call leaves the first chart in place.superset_update_dashboard_filterswith onefilter_select: filter appears in the UI.Public MCP signatures unchanged. Serialization sites accept dict, list, or pre-stringified JSON.