After regenerating docs/mammon-api.yml / src/generated/mammon/ from mammon's current OpenAPI spec (feature/transaction-valuation merge), npm run build / vue-tsc --noEmit fails. The regenerated client contains self-referencing TypeScript interfaces for the discriminated-union response types, plus several downstream call sites that no longer compile against the new shapes.
Steps to reproduce
cd gemory && npx vue-tsc --noEmit
Expected
Clean typecheck against the regenerated client.
Actual
src/generated/mammon/api.ts(149,18): error TS2310: Type 'CombinedLedgerResponse' recursively references itself as a base type.
src/generated/mammon/api.ts(149,49): error TS2312: An interface can only extend an object type or intersection of object types with statically known members.
src/generated/mammon/api.ts(301,18): error TS2310: Type 'IskTransferResponse' recursively references itself as a base type.
src/generated/mammon/api.ts(301,46): error TS2312: An interface can only extend an object type or intersection of object types with statically known members.
src/generated/mammon/api.ts(331,18): error TS2310: Type 'ItemTransferResponse' recursively references itself as a base type.
src/generated/mammon/api.ts(331,47): error TS2312: An interface can only extend an object type or intersection of object types with statically known members.
src/generated/mammon/api.ts(358,18): error TS2310: Type 'MainLedgerResponse' recursively references itself as a base type.
src/generated/mammon/api.ts(358,45): error TS2312: An interface can only extend an object type or intersection of object types with statically known members.
Plus downstream compile errors at call sites relying on the old shape:
src/ledger/EditLedgerModal.vue — type string not assignable to "COMBINED" | "MAIN", Property 'type' does not exist on type 'MainLedgerResponse'
src/ledger/ledger.ts:38,41 — Property 'type' does not exist on type 'Ledger' (Ledger = generated LedgerResponse union)
src/transaction/TransferList.vue — TransferResponse union no longer assignable to the local TransferWithValue type; several unknown-typed narrowing failures
src/pages/market/TypeInfo.vue:52 — Property 'source' does not exist on type 'AcquisitionResponse'
Notes
Root cause for the api.ts interface errors: LedgerResponse (and TransferResponse) are OpenAPI oneOf + discriminator schemas, and each variant (MainLedgerResponse, CombinedLedgerResponse, IskTransferResponse, ItemTransferResponse) is defined via allOf: [$ref: LedgerResponse, ...] on the mammon side. openapi-generator's typescript-axios generator turns the discriminated parent into a type alias (type LedgerResponse = {type: 'COMBINED'} & CombinedLedgerResponse | {type: 'MAIN'} & MainLedgerResponse) instead of an interface, then emits interface MainLedgerResponse extends LedgerResponse for the variant — extending a type alias that resolves back to itself, hence the TS2310 recursion error.
Confirmed this is not caused by the profit/margin wiring work (gemory profitApi wiring) — those two files are the only ones touched for that, and this breakage is isolated to the ledger/transfer discriminated-union schemas and their generated client.
Two possible fix directions to evaluate during refinement:
Change how mammon's Swagger/OpenAPI annotations model these discriminated unions (e.g. avoid allOf referencing the discriminator parent directly) so the generator produces non-recursive types.
Post-process/patch the generated client, or adjust the gemory consumer code to work around the generator's output shape.
Since src/generated/mammon/ is documented as generated/do-not-edit, the fix likely needs to originate on the mammon OpenAPI schema side (mammon #cross-repo), unless the generator config in gemory can be adjusted instead.
Related
Surfaced while wiring gemory to mammon's feature/transaction-valuation branch (profit/margin endpoints).
## Summary
After regenerating `docs/mammon-api.yml` / `src/generated/mammon/` from mammon's current OpenAPI spec (feature/transaction-valuation merge), `npm run build` / `vue-tsc --noEmit` fails. The regenerated client contains self-referencing TypeScript interfaces for the discriminated-union response types, plus several downstream call sites that no longer compile against the new shapes.
## Steps to reproduce
1. `cd gemory && npx vue-tsc --noEmit`
## Expected
Clean typecheck against the regenerated client.
## Actual
```
src/generated/mammon/api.ts(149,18): error TS2310: Type 'CombinedLedgerResponse' recursively references itself as a base type.
src/generated/mammon/api.ts(149,49): error TS2312: An interface can only extend an object type or intersection of object types with statically known members.
src/generated/mammon/api.ts(301,18): error TS2310: Type 'IskTransferResponse' recursively references itself as a base type.
src/generated/mammon/api.ts(301,46): error TS2312: An interface can only extend an object type or intersection of object types with statically known members.
src/generated/mammon/api.ts(331,18): error TS2310: Type 'ItemTransferResponse' recursively references itself as a base type.
src/generated/mammon/api.ts(331,47): error TS2312: An interface can only extend an object type or intersection of object types with statically known members.
src/generated/mammon/api.ts(358,18): error TS2310: Type 'MainLedgerResponse' recursively references itself as a base type.
src/generated/mammon/api.ts(358,45): error TS2312: An interface can only extend an object type or intersection of object types with statically known members.
```
Plus downstream compile errors at call sites relying on the old shape:
- `src/ledger/EditLedgerModal.vue` — `type` string not assignable to `"COMBINED" | "MAIN"`, `Property 'type' does not exist on type 'MainLedgerResponse'`
- `src/ledger/ledger.ts:38,41` — `Property 'type' does not exist on type 'Ledger'` (`Ledger` = generated `LedgerResponse` union)
- `src/transaction/TransferList.vue` — `TransferResponse` union no longer assignable to the local `TransferWithValue` type; several `unknown`-typed narrowing failures
- `src/pages/market/TypeInfo.vue:52` — `Property 'source' does not exist on type 'AcquisitionResponse'`
## Notes
Root cause for the `api.ts` interface errors: `LedgerResponse` (and `TransferResponse`) are OpenAPI `oneOf` + `discriminator` schemas, and each variant (`MainLedgerResponse`, `CombinedLedgerResponse`, `IskTransferResponse`, `ItemTransferResponse`) is defined via `allOf: [$ref: LedgerResponse, ...]` on the mammon side. openapi-generator's typescript-axios generator turns the discriminated parent into a type alias (`type LedgerResponse = {type: 'COMBINED'} & CombinedLedgerResponse | {type: 'MAIN'} & MainLedgerResponse`) instead of an interface, then emits `interface MainLedgerResponse extends LedgerResponse` for the variant — extending a type alias that resolves back to itself, hence the TS2310 recursion error.
Confirmed this is not caused by the profit/margin wiring work (gemory `profitApi` wiring) — those two files are the only ones touched for that, and this breakage is isolated to the ledger/transfer discriminated-union schemas and their generated client.
Two possible fix directions to evaluate during refinement:
1. Change how mammon's Swagger/OpenAPI annotations model these discriminated unions (e.g. avoid `allOf` referencing the discriminator parent directly) so the generator produces non-recursive types.
2. Post-process/patch the generated client, or adjust the `gemory` consumer code to work around the generator's output shape.
Since `src/generated/mammon/` is documented as generated/do-not-edit, the fix likely needs to originate on the mammon OpenAPI schema side (`mammon #cross-repo`), unless the generator config in gemory can be adjusted instead.
## Related
Surfaced while wiring gemory to mammon's `feature/transaction-valuation` branch (profit/margin endpoints).
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
After regenerating
docs/mammon-api.yml/src/generated/mammon/from mammon's current OpenAPI spec (feature/transaction-valuation merge),npm run build/vue-tsc --noEmitfails. The regenerated client contains self-referencing TypeScript interfaces for the discriminated-union response types, plus several downstream call sites that no longer compile against the new shapes.Steps to reproduce
cd gemory && npx vue-tsc --noEmitExpected
Clean typecheck against the regenerated client.
Actual
Plus downstream compile errors at call sites relying on the old shape:
src/ledger/EditLedgerModal.vue—typestring not assignable to"COMBINED" | "MAIN",Property 'type' does not exist on type 'MainLedgerResponse'src/ledger/ledger.ts:38,41—Property 'type' does not exist on type 'Ledger'(Ledger= generatedLedgerResponseunion)src/transaction/TransferList.vue—TransferResponseunion no longer assignable to the localTransferWithValuetype; severalunknown-typed narrowing failuressrc/pages/market/TypeInfo.vue:52—Property 'source' does not exist on type 'AcquisitionResponse'Notes
Root cause for the
api.tsinterface errors:LedgerResponse(andTransferResponse) are OpenAPIoneOf+discriminatorschemas, and each variant (MainLedgerResponse,CombinedLedgerResponse,IskTransferResponse,ItemTransferResponse) is defined viaallOf: [$ref: LedgerResponse, ...]on the mammon side. openapi-generator's typescript-axios generator turns the discriminated parent into a type alias (type LedgerResponse = {type: 'COMBINED'} & CombinedLedgerResponse | {type: 'MAIN'} & MainLedgerResponse) instead of an interface, then emitsinterface MainLedgerResponse extends LedgerResponsefor the variant — extending a type alias that resolves back to itself, hence the TS2310 recursion error.Confirmed this is not caused by the profit/margin wiring work (gemory
profitApiwiring) — those two files are the only ones touched for that, and this breakage is isolated to the ledger/transfer discriminated-union schemas and their generated client.Two possible fix directions to evaluate during refinement:
allOfreferencing the discriminator parent directly) so the generator produces non-recursive types.gemoryconsumer code to work around the generator's output shape.Since
src/generated/mammon/is documented as generated/do-not-edit, the fix likely needs to originate on the mammon OpenAPI schema side (mammon #cross-repo), unless the generator config in gemory can be adjusted instead.Related
Surfaced while wiring gemory to mammon's
feature/transaction-valuationbranch (profit/margin endpoints).