Skip to content

C#: add --use-records option for C# 9+ record types#3071

Merged
schani merged 8 commits into
glideapps:masterfrom
naughtyGitCat:agent/fix-issue-1778
Jul 23, 2026
Merged

C#: add --use-records option for C# 9+ record types#3071
schani merged 8 commits into
glideapps:masterfrom
naughtyGitCat:agent/fix-issue-1778

Conversation

@naughtyGitCat

Copy link
Copy Markdown
Contributor

Summary

  • Adds a C# --use-records renderer option that emits partial record instead of partial class for data types (C# 9+).
  • Works with both Newtonsoft and System.Text.Json; FromJson partials match the type kind so they merge correctly.
  • Helper types (Serialize, Converter) and synthetic top-level wrappers stay classes; unions stay structs.
  • Adds unit coverage and end-to-end fixture quick-test options for both frameworks.

Closes #1778.

Test plan

  • npm run build
  • npm run lint
  • npm run test:unit -- test/unit/csharp-records.test.ts test/unit/just-types-option.test.ts
  • QUICKTEST=true FIXTURE=csharp npm run test:fixtures (includes use-records: true combinations)
  • QUICKTEST=true FIXTURE=csharp-SystemTextJson npm run test:fixtures (includes use-records: true combinations)
  • Manual CLI smoke test: quicktype sample.json -l csharp --use-records and --just-types

naughtyGitCat and others added 2 commits July 22, 2026 10:02
Emit partial records instead of classes when requested, for both
Newtonsoft and System.Text.Json. Closes glideapps#1778.
@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown

Generated-output differences

318 files differ — 0 modified, 318 new, 0 deleted
189565 changed lines — +189565 / −0

Open the generated-output report →

@github-actions

Copy link
Copy Markdown

Generated-output differences

314 files differ — 0 modified, 314 new, 0 deleted
176482 changed lines — +176482 / −0

Open the generated-output report →

@github-actions

Copy link
Copy Markdown

Generated-output differences

314 files differ — 0 modified, 314 new, 0 deleted
176482 changed lines — +176482 / −0

Open the generated-output report →

@schani
schani merged commit 65a1289 into glideapps:master Jul 23, 2026
171 of 198 checks passed
@schani

schani commented Jul 23, 2026

Copy link
Copy Markdown
Member

Thank you so much!

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.

Add C# record type support

2 participants