Migrate PHP SDK codegen to use blueprint as sole input#448
Conversation
Remove all the temporary output-parity workarounds and their TODOs from the codegen. The generator no longer parses the OpenAPI spec: resource object classes, client classes, and methods are all derived from @seamapi/blueprint. Events, action attempts, and discriminated object lists are merged into single classes; nested namespaces are now wired to their parent clients; the parameter sort precedence bug is fixed; and integer parameters map to float instead of mixed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EjeywMUAsXPYML3H7imc4H
Filter blueprint resources, events, action attempts, and their properties on isUndocumented, dropping resource object classes such as PhoneSession and BridgeClientSession that are not part of the public SDK. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EjeywMUAsXPYML3H7imc4H
Upgrade @seamapi/blueprint to 0.57.0 and map integer request parameters to the PHP int type instead of float. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EjeywMUAsXPYML3H7imc4H
|
BREAKING CHANGE: The parameter order of two
BREAKING CHANGE: BREAKING CHANGE: BREAKING CHANGE: Resource object constructor parameters are now ordered alphabetically and uniformly nullable. Only affects code constructing resource objects positionally; objects returned by the SDK are unaffected. Non-breaking: undocumented resources (e.g. Generated by Claude Code |
Upgrade @seamapi/blueprint to 0.58.0, which adds the isInt flag to number properties, and @seamapi/types to 1.966.0, which restores the missing created_at property on error and warning resources. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EjeywMUAsXPYML3H7imc4H
|
Revised breaking-change note (supersedes my previous comment — after upgrading to @seamapi/types 1.966.0, BREAKING CHANGE: The parameter order of two
BREAKING CHANGE: BREAKING CHANGE: Resource object constructor parameters are now ordered alphabetically and uniformly nullable. Only affects code constructing resource objects positionally; objects returned by the SDK are unaffected. Non-breaking: undocumented resources (e.g. Generated by Claude Code |
Pick up the isItemInt flag on number list parameters and properties. Generated output is unchanged since PHP list types do not declare an item type. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EjeywMUAsXPYML3H7imc4H
This PR migrates the PHP SDK code generator to use the
@seamapi/blueprintas the sole input source, eliminating the dependency on OpenAPI schema parsing and temporary workaround code.Summary
The codegen pipeline has been refactored to derive all PHP SDK source files directly from the blueprint, removing the intermediate OpenAPI parsing layer that was previously used for output parity with the legacy generator.
Key Changes
deep-extract-resource-object-schemas.ts,get-parameter-and-response-schema.ts,deep-flatten-one-of-and-all-of-schema.ts,flatten-obj-schema.ts,types.ts,map-parent-to-children-resource.ts,get-filtered-routes.ts,endpoint-rules.ts) that were frozen workarounds for output parityresource-model.tsto build resource object class models directly from blueprint resources, handling nested objects, lists, and discriminated unionsroutes.tsto use blueprint as the only input, removing all OpenAPI schema consultationmap-php-type.tsandclass-model.tsto work with blueprint types instead of OpenAPI schemasobject.tsandseam-client.tsto use blueprint-derived resource models?? null) since blueprint doesn't track required propertiesPagination,PhoneRegistration)from_jsonmethods to use null coalescing for consistencyImplementation Details
The resource object model now directly maps blueprint resources to PHP classes, with nested properties and discriminated unions properly flattened into single classes with the union of variant properties. This eliminates the need for complex OpenAPI schema traversal and normalization logic.
https://claude.ai/code/session_01EjeywMUAsXPYML3H7imc4H