Skip to content

Commit

Permalink
fix(type-safe-api): fix websocket api client compilation issue (#848)
Browse files Browse the repository at this point in the history
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
cogwirrel authored Oct 9, 2024
1 parent e098d97 commit 25db3d3
Show file tree
Hide file tree
Showing 7 changed files with 235 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@
}
###/TSAPI_WRITE_FILE###/* tslint:disable */
/* eslint-disable */
export * from './runtime';
export * from './models';
export * from './client/client';
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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* NOTE: This class is auto generated.
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
import { exists, mapValues } from './model-utils';
<%_ model.uniqueImports.forEach((importName) => { _%>
import type { <%= importName %> } from './<%= importName %>';
import {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 25db3d3

Please sign in to comment.