mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-09-10 22:43:37 +00:00
fix(api): generate typescript EventEnvelope with typed seq
The typescript-axios generator was collapsing EventEnvelope's allOf([inline_object, $ref: RunEvent]) to a bare `type EventEnvelope = RunEvent` alias, losing the `seq` field at the type level. TypeScript consumers could write `envelope.seq` and get `any` (via RunEvent's additionalProperties index signature), but had no type-level guarantee that seq was present. Extract `EventSeq` as a named component schema and switch EventEnvelope's allOf to two $refs. typescript-axios now generates `export type EventEnvelope = EventSeq & RunEvent`, which makes `envelope.seq: number` a typed property. The Rust progenitor client is unchanged: it still flattens the allOf into a single EventEnvelope struct with `seq: i64` inline, exactly as before. Wire JSON is byte-identical on both sides. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
30fcee98c2
commit
9b0b8d94fc
5 changed files with 44 additions and 9 deletions
|
|
@ -2712,20 +2712,24 @@ components:
|
|||
additionalProperties: true
|
||||
additionalProperties: true
|
||||
|
||||
EventSeq:
|
||||
description: Assigned sequence number component of a stored event envelope.
|
||||
type: object
|
||||
required:
|
||||
- seq
|
||||
properties:
|
||||
seq:
|
||||
type: integer
|
||||
description: Assigned event sequence number.
|
||||
example: 42
|
||||
|
||||
EventEnvelope:
|
||||
description: >
|
||||
Stored event envelope with assigned sequence number. On the wire the
|
||||
envelope is flattened: seq sits alongside the RunEvent payload fields
|
||||
at the top level of the JSON object.
|
||||
allOf:
|
||||
- type: object
|
||||
required:
|
||||
- seq
|
||||
properties:
|
||||
seq:
|
||||
type: integer
|
||||
description: Assigned event sequence number.
|
||||
example: 42
|
||||
- $ref: "#/components/schemas/EventSeq"
|
||||
- $ref: "#/components/schemas/RunEvent"
|
||||
|
||||
PaginatedEventList:
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ models/disk-usage-summary-row.ts
|
|||
models/error-response-entry.ts
|
||||
models/error-response.ts
|
||||
models/event-envelope.ts
|
||||
models/event-seq.ts
|
||||
models/execute-query-request.ts
|
||||
models/execute-query-response-rows-inner-inner.ts
|
||||
models/execute-query-response.ts
|
||||
|
|
|
|||
|
|
@ -18,12 +18,15 @@
|
|||
import type { ActorRef } from './actor-ref';
|
||||
// May contain unused imports in some cases
|
||||
// @ts-ignore
|
||||
import type { EventSeq } from './event-seq';
|
||||
// May contain unused imports in some cases
|
||||
// @ts-ignore
|
||||
import type { RunEvent } from './run-event';
|
||||
|
||||
/**
|
||||
* @type EventEnvelope
|
||||
* Stored event envelope with assigned sequence number. On the wire the envelope is flattened: seq sits alongside the RunEvent payload fields at the top level of the JSON object.
|
||||
*/
|
||||
export type EventEnvelope = RunEvent;
|
||||
export type EventEnvelope = EventSeq & RunEvent;
|
||||
|
||||
|
||||
|
|
|
|||
26
lib/packages/fabro-api-client/src/models/event-seq.ts
Normal file
26
lib/packages/fabro-api-client/src/models/event-seq.ts
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Fabro Run API
|
||||
* HTTP API for managing Fabro workflow run executions.
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Assigned sequence number component of a stored event envelope.
|
||||
*/
|
||||
export interface EventSeq {
|
||||
/**
|
||||
* Assigned event sequence number.
|
||||
*/
|
||||
'seq': number;
|
||||
}
|
||||
|
||||
|
|
@ -44,6 +44,7 @@ export * from './disk-usage-summary-row';
|
|||
export * from './error-response';
|
||||
export * from './error-response-entry';
|
||||
export * from './event-envelope';
|
||||
export * from './event-seq';
|
||||
export * from './execute-query-request';
|
||||
export * from './execute-query-response';
|
||||
export * from './execute-query-response-rows-inner-inner';
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue