Skip to content

Commit deef88b

Browse files
committed
refactor: Port C# SDK generation from nextlove to Metalsmith
Replace @seamapi/nextlove-sdk-generator with a Metalsmith + Handlebars pipeline (via @seamapi/smith), mirroring the javascript-http and python codegen architecture. The nextlove C# generator (its AST codegen framework, dataclass serializer, and OpenAPI helpers) is ported verbatim under codegen/lib as TEMPORARY output-parity workarounds, so the generated output stays byte-identical after csharpier. A thin, durable Metalsmith plugin (codegen/lib/csharp.ts) drives the port and emits each generated file through a passthrough layout. - codegen/smith.ts: Metalsmith entry point - codegen/lib/csharp.ts: plugin wrapping the ported generator - codegen/lib/generate-csharp-sdk.ts, codegen.ts, dataclass.ts, schema-modifications.ts, endpoint-rules.ts, types.ts, openapi/*: verbatim TEMPORARY ports (grep TEMPORARY to skip in review) - Keep @seamapi/types pinned at 1.691.0 and change-case at ^4; the generated output is tied to both - Adopt @seamapi/smith eslint/tsconfig config; add eslint.config.ts, tsconfig.json, .prettierignore; wire lint/typecheck/format scripts - Bump Node to 24 (.nvmrc, setup action) and CI test matrix to 22 (@seamapi/smith requires Node >=20.9) The generator does not clean the output directory: the previous generator overwrote without deleting, so the committed output still contains stale files for schemas removed from the pinned types. Cleaning would change the output and is deferred (see TODO in smith.ts). @seamapi/blueprint is installed to satisfy the smith peer dependency but is not wired into the pipeline: the port iterates the raw OpenAPI spec for parity, and blueprint 0.55.0 does not parse the pinned types. Verified: generated output is byte-identical after csharpier 0.29.2; npm run lint, typecheck, and format all pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018oCdmrhyAEX8e9sAFRXZAF
1 parent d10e0ea commit deef88b

48 files changed

Lines changed: 10044 additions & 3018 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/actions/setup/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ inputs:
99
node_version:
1010
description: The Node.js version.
1111
required: false
12-
default: '18'
12+
default: '24'
1313
registry_url:
1414
description: The Node.js package registry URL.
1515
required: false

.github/workflows/check.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ jobs:
1717
os:
1818
- ubuntu-latest
1919
node:
20-
- '16'
21-
- '18'
20+
- '22'
2221
include:
2322
- os: ubuntu-latest
2423
os_name: Linux
@@ -40,8 +39,7 @@ jobs:
4039
fail-fast: false
4140
matrix:
4241
node:
43-
- '16'
44-
- '18'
42+
- '22'
4543
steps:
4644
- name: Checkout
4745
uses: actions/checkout@v3
@@ -65,8 +63,7 @@ jobs:
6563
fail-fast: false
6664
matrix:
6765
node:
68-
- '16'
69-
- '18'
66+
- '22'
7067
steps:
7168
- name: Checkout
7269
uses: actions/checkout@v3

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
# For more details, visit the project page:
66
# https://github.com/github/gitignore
77

8+
# Codegen
9+
CODEGEN.md
10+
811
# TypeScript build output
912
*.d.ts
1013
*.js

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
lts/hydrogen
1+
24

.prettierignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Prettier exceptions
2+
3+
*.hbs
4+
CODEGEN.md

codegen/content/CODEGEN.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Codegen

codegen/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default null

codegen/layouts/default.hbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{{contents}}

0 commit comments

Comments
 (0)