Skip to content

Remove Newtonsoft.Json — migrate to System.Text.Json.Nodes#2

Merged
michaldengusiak merged 6 commits into
sow/2026-Q2from
feature/remove-newtonsoft
May 18, 2026
Merged

Remove Newtonsoft.Json — migrate to System.Text.Json.Nodes#2
michaldengusiak merged 6 commits into
sow/2026-Q2from
feature/remove-newtonsoft

Conversation

@michaldengusiak
Copy link
Copy Markdown

@michaldengusiak michaldengusiak commented May 15, 2026

Summary

Migrates this SAM-BIM downstream repo from Newtonsoft.Json to System.Text.Json.Nodes to track the SAM core migration in SAM-BIM/SAM#3.

  • Each csproj's <PackageReference Include="Newtonsoft.Json"> is replaced with <PackageReference Include="System.Text.Json" Version="10.0.8" /> (matches SAM.Core's pinned version)
  • Source-level migration:
    • JObject / JArray / JToken / JValueJsonObject / JsonArray / JsonNode / JsonValue
    • FromJObject(JObject) / JObject ToJObject()FromJsonObject(JsonObject) / JsonObject ToJsonObject()
    • .Value<T>(key)["key"]?.GetValue<T>() ?? default(T)
    • foreach (JObject in JArray) rewritten as foreach (JsonNode) { if (!(node is JsonObject)) continue; … } (C# 7.3 compatible)
    • JsonConvert.DeserializeObject<JObject>(s) / JObject.Parse(s)JsonNode.Parse(s) as JsonObject

Verification

  • Local BuildAlls_v3 RestoreCleanRebuild across the full SAM-BIM dependency chain (SAM → … → SAM_Revit_UI Debug2025/2026): 0 errors, 144 artifacts.
  • 0 source-level shim references (JObject / JArray / JToken / JValue / ToJObject / FromJObject) remain in this repo.

Test plan

  • CI build passes
  • Manual smoke: open & save a representative SAM model via this add-in/library if it has a runtime surface (Revit, Tas, Mollier, UI, Grasshopper)

🤖 Generated with Claude Code

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

michaldengusiak and others added 5 commits May 15, 2026 22:01
During the SAM-BIM Newtonsoft.Json -> System.Text.Json migration the
quarterly sow/2026-Q2 branch carries the binary-breaking change. CI needs
to consume the migrated SAM (and any sibling dep) from sow/2026-Q2, not
from master, until the quarter-end merge.

- Add "sow/2026-Q2" to push/pull_request branch triggers
- For each dep clone, ls-remote sow/2026-Q2 and prefer it when present;
  fall back to default branch (e.g. master) otherwise. After the quarter
  merges back to master, this fallback naturally restores prior behaviour.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Refines the previous workflow patch so CI on the migration PR can succeed
before anything has been merged. Each dep repo is cloned from:
1. github.head_ref (feature/remove-newtonsoft on these PRs) - has the
   migration right now on every dep
2. sow/2026-Q2 - source of truth after these PRs merge
3. default branch - source of truth after quarter-end merge

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Mirrors the fix already applied on SAM_Revit / SAM_Revit_UI: this
workflow also clones the private SAM_Solver dep, so the cascade
ls-remote and clone must use the token-prefixed URL when $token is
defined, otherwise GitHub prompts for credentials and CI fails with
'Cannot prompt because user interactivity has been disabled'.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The harmonized spdx-check workflow requires both header lines in the
top 80 lines of every changed .cs file. SAM_UI was missed in the earlier
fix-spdx pass; adding the header to the 45 files in the migration diff
(excluding Properties/ and *.xaml.cs which the workflow skips).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The earlier fix_spdx pass detected only the en-dash form of the
copyright line. Files that already had a hyphen-minus header got a
second header pair prepended above the original instead of being
recognised as already-compliant. Strip the duplicate, keeping the
first (en-dash) pair.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@michaldengusiak michaldengusiak merged commit 93f9da9 into sow/2026-Q2 May 18, 2026
2 checks passed
@michaldengusiak michaldengusiak deleted the feature/remove-newtonsoft branch May 18, 2026 13:37
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.

2 participants