Context
The Python codegen generates production-quality clients — validated against Partly's core-server (284 endpoints, 59K-line generated client, live API authentication). This issue tracks remaining improvements to reach full TypeScript parity.
Completed
Remaining
1. Flattened generic fields silently dropped (P0 correctness)
When a struct has #[serde(flatten)] on a generic type parameter (e.g. IdentityData<I, D> where data: D is flattened), the Python codegen silently drops the field. This affects 11 generic types and 26 endpoints in core-server (9% of API). TypeScript handles this via intersection types (& NullToEmptyObject<D>); Python needs either monomorphization or a runtime flatten mechanism.
Affected types: IdentityData, InsertOrElse, RemoveOrElse, UpdateOrElse, nomatches::*
2. Reduce namespace bloat
402 namespace classes for core-server. Collapse single-type namespaces.
3. Sync/async runtime deduplication
~500 lines of identical sync/async code in runtime. Could use a shared implementation pattern.
Context
The Python codegen generates production-quality clients — validated against Partly's core-server (284 endpoints, 59K-line generated client, live API authentication). This issue tracks remaining improvements to reach full TypeScript parity.
Completed
Field(description="...")propagated from schemaApiResponse[OutputType, ErrorType]in method signaturesgenerate_testingdefault changed to false_T_prefix for colliding namesApplicationError.typed_erroras Pydantic modellist[Model]via TypeAdapter (was returning raw dicts)validate_json(bytes)SystemSystem→Systemwhen module prefix matches type prefix"""Generated data model."""when no description availabler.field_0instead of incorrectr.valuefor tuple variant fieldsRemaining
1. Flattened generic fields silently dropped (P0 correctness)
When a struct has
#[serde(flatten)]on a generic type parameter (e.g.IdentityData<I, D>wheredata: Dis flattened), the Python codegen silently drops the field. This affects 11 generic types and 26 endpoints in core-server (9% of API). TypeScript handles this via intersection types (& NullToEmptyObject<D>); Python needs either monomorphization or a runtime flatten mechanism.Affected types:
IdentityData,InsertOrElse,RemoveOrElse,UpdateOrElse,nomatches::*2. Reduce namespace bloat
402 namespace classes for core-server. Collapse single-type namespaces.
3. Sync/async runtime deduplication
~500 lines of identical sync/async code in runtime. Could use a shared implementation pattern.