Port PHP SDK code generation from nextlove to Metalsmith#446
Merged
Conversation
Replace the @seamapi/nextlove-sdk-generator based generation with the metalsmith + handlebars + @seamapi/blueprint architecture used by seamapi/javascript-http and seamapi/python. The generated output under src/ (SeamClient.php and Objects/*.php) is byte-identical. The blueprint drives the route, endpoint, and namespace iteration order. The raw OpenAPI spec is still consulted wherever the nextlove generator derived output from data the blueprint normalizes differently (integer vs number types, resource schema set and order, parameter and oneOf/allOf flattening, deeply nested namespaces); each of those spots carries a TODO to migrate to the blueprint once output is allowed to change, and the supporting code lives in files marked TEMPORARY. - Add codegen/ with the Metalsmith pipeline, plugin, context builders, and Handlebars layouts and partials - Remove generate-routes.js - Pin @seamapi/types at 1.827.0 for output parity and use @seamapi/blueprint 0.55.0 with @seamapi/smith - Add tsconfig.json, a one-line eslint.config.ts, and typecheck, lint, postlint, and preformat scripts matching seamapi/docs - Ignore *.hbs and CODEGEN.md in a new .prettierignore since the glimmer parser mangles PHP-flavored templates, and format .ts with the js rules - Ignore the generated CODEGEN.md seed and *.tsbuildinfo in .gitignore Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UrUX4ghim2PDnBjXayuLDj
The HttpError and Paginator tests ran against the hosted fake.seam.vc test server, so they fail whenever that service is unavailable (as it currently is, returning 500s) rather than testing the SDK. Remove those server-dependent tests and the Fixture helper. Keep testNonSeamError, which exercises the client's connection-error handling against an unreachable host and needs no Seam server. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UrUX4ghim2PDnBjXayuLDj
The previous commit deleted tests/Fixture.php but did not stage the HttpErrorTest edit that removes its Fixture usage, so CI still ran the old server-dependent tests and errored with "Class Tests\Fixture not found". Apply the intended HttpErrorTest, leaving only testNonSeamError. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UrUX4ghim2PDnBjXayuLDj
razor-x
marked this pull request as ready for review
July 21, 2026 22:05
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
Migrate the PHP SDK code generation from the
@seamapi/nextlove-sdk-generatorpackage to an in-repo Metalsmith-based plugin. This replaces the external dependency with a local implementation that maintains byte-identical output while enabling future improvements.Key Changes
codegen/lib/routes.ts): Core code generation logic that iterates over blueprint routes and endpoints to generate PHP resource classes and client methodsdeep-extract-resource-object-schemas.ts: Extracts nested object schemas into separate resource classesget-parameter-and-response-schema.ts: Parses request/response schemas from OpenAPIdeep-flatten-one-of-and-all-of-schema.ts: Flattens complex schema compositionsflatten-obj-schema.ts: Normalizes object schemasget-filtered-routes.ts: Filters routes based on OpenAPI extensionsmap-parent-to-children-resource.ts: Maps parent resources to child namespaceslayouts/object.ts: Builds context for resource object classeslayouts/seam-client.ts: Builds context for SeamClient and resource client classeslayouts/object.hbs: Resource object class templatelayouts/seam-client.hbs: SeamClient class templatelayouts/partials/client-class.hbs: Resource client class templatelayouts/partials/route-method.hbs: Client method templatelayouts/partials/poll-until-ready.hbs: Action attempt polling templatecodegen/smith.ts: Metalsmith pipeline setuptsconfig.json: TypeScript configurationeslint.config.ts: ESLint configurationpackage.jsonto usetsx codegen/smith.tsinstead ofnode generate-routes.jsImplementation Details
@seamapi/blueprintonce output changes are allowedhttps://claude.ai/code/session_01UrUX4ghim2PDnBjXayuLDj