feat: Migrate codegen to use use Blueprint#585
Merged
Conversation
Remove all TEMPORARY output-parity workarounds and their TODOs from the
codegen. The generator now consumes only the Blueprint from
@seamapi/blueprint; the raw OpenAPI spec is no longer parsed anywhere in
this repository's codegen (it is only passed to the blueprint plugin,
which builds the Blueprint from it).
- Delete codegen/lib/openapi/, map-python-type.ts, and endpoint-rules.ts.
- Filter endpoints on blueprint isUndocumented flags instead of raw
x-undocumented/x-fern-sdk-group-name extensions and hardcoded path
lists.
- Derive namespaces and parent/child class wiring from blueprint route
and namespace paths, which now also wires deeply nested namespaces
(seam.acs.encoders.simulate) to their parent class.
- Derive method parameters from endpoint.request.parameters and return
types from endpoint.response via a new blueprint-format-to-Python-type
mapping (codegen/lib/python-type.ts).
- Build models.py from blueprint resources, events, action attempts, and
pagination, merging event and action attempt variant properties into
single dataclasses.
- Fix the parameter sort comparator precedence so an explicit position
sorts a parameter first.
Expected generated output changes:
- integer parameters and properties are now typed float (the blueprint
collapses integer into number)
- new workspaces.update() method returning None
- seam.acs.encoders.simulate is now reachable
- {resource}_id parameter sorts first in get() methods
- PhoneRegistration model removed (blueprint omits it; it was referenced
nowhere)
- ActionAttempt.result is now Dict[str, Any] with DeepAttrDict access
- Batch fields are now List[Dict[str, Any]]; Device.device_type is now
str
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011TdqYTYvyrK8rrR7FL1Aax
Upgrade @seamapi/blueprint to 0.58.0 and map number parameters and properties with isInt to Python int, restoring the integer types that were collapsed to float when the codegen moved off the raw OpenAPI schemas. List items carry no isInt flag, so numbers inside lists remain float. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011TdqYTYvyrK8rrR7FL1Aax
razor-x
marked this pull request as ready for review
July 23, 2026 15:22
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
This PR migrates the Python SDK code generator from parsing raw OpenAPI schemas to using the Blueprint specification that is already available in Metalsmith metadata. This eliminates the need for frozen output-parity workarounds and simplifies the codebase by removing temporary OpenAPI parsing utilities.
Key Changes
Removed OpenAPI parsing dependencies: Deleted temporary files that were verbatim ports from the previous generator:
openapi/get-parameter-and-response-schema.tsopenapi/deep-flatten-one-of-and-all-of-schema.tsopenapi/flatten-obj-schema.tsopenapi/map-parent-to-children-resource.tsopenapi/get-filtered-routes.tsopenapi/types.tsmap-python-type.tsendpoint-rules.tsRefactored route generation (
codegen/lib/routes.ts):blueprint.routesandblueprint.namespacesinstead of OpenAPI pathsparentPathrelationshipsisUndocumentedflags instead of OpenAPI extensionsCreated new type mapping module (
codegen/lib/python-type.ts):mapParameterToPythonType()andmapPropertyToPythonType()use Blueprint's format systemUpdated models layout context (
codegen/lib/layouts/models.ts):blueprint.resources,blueprint.events, andblueprint.actionAttemptsdirectlyType refinements (
seam/routes/models.py):ActionAttempt.resultfromAnytoDict[str, Any]Batchresource list properties fromList[Any]toList[Dict[str, Any]]Device.device_typefromAnytostrDevice.propertiesfromAnytoDict[str, Any]PhoneRegistrationdataclassThermostatSchedule.max_override_period_minutesfrominttofloatUnmanagedDevice.device_typefromAnytostrAbstractAcsEncodersclass (moved to simulate submodule)limitparameters fromOptional[int]toOptional[float]AcsUsers.get()andEvents.get()for consistencyRoute file updates:
workspaces.update()methodfloatinstead ofintfor pagination limitsAcsEncodersSimulateinacs_encoders.py)Implementation Details
toNamespace()function converts paths like/acs/encoderstoacs_encoders)parentPathvalues from Blueprint entrieshttps://claude.ai/code/session_011TdqYTYvyrK8rrR7FL1Aax