-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(type-safe-api): fix websocket api client compilation issue (#848)
The websocket api client library failed to compile due to a missing `runtime.ts` file, which the models depend on. As `runtime.ts` is predominantly http api focussed, we add a `model-utils.ts` file with just the required methods such that models are independent of http api files.
- Loading branch information
Showing
7 changed files
with
235 additions
and
39 deletions.
There are no files selected for viewing
This file contains 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
22 changes: 22 additions & 0 deletions
22
...fe-api/scripts/type-safe-api/generators/typescript/templates/client/models/modelUtils.ejs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
###TSAPI_WRITE_FILE### | ||
{ | ||
"id": "model-utils", | ||
"dir": "<%= metadata.srcDir || 'src' %>/models", | ||
"name": "model-utils", | ||
"ext": ".ts", | ||
"overwrite": true | ||
} | ||
###/TSAPI_WRITE_FILE###/* tslint:disable */ | ||
/* eslint-disable */ | ||
|
||
export function mapValues(data: any, fn: (item: any) => any) { | ||
return Object.keys(data).reduce( | ||
(acc, key) => ({ ...acc, [key]: fn(data[key]) }), | ||
{} | ||
); | ||
} | ||
|
||
export function exists(json: any, key: string) { | ||
const value = json[key]; | ||
return value !== null && value !== undefined; | ||
} |
This file contains 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
44 changes: 38 additions & 6 deletions
44
...-safe-api/test/scripts/generators/__snapshots__/typescript-react-query-hooks.test.ts.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.