Skip to content

Commit 6365286

Browse files
authored
Merge branch 'main' into fix/oneof-discriminator-required
2 parents cbe18a6 + 5deefc4 commit 6365286

File tree

31 files changed

+10076
-33
lines changed

31 files changed

+10076
-33
lines changed

.changeset/serious-bottles-buy.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
'@hey-api/openapi-ts': minor
3+
---
4+
5+
feat: respect `moduleResolution` value in `tsconfig.json`
6+
7+
### Respecting `moduleResolution` value in `tsconfig.json`
8+
9+
This release introduces functionality related to your `tsconfig.json` file. The initial feature properly respects the value of your `moduleResolution` field. If you're using `nodenext`, the relative module paths in your output will be appended with `.js`. To preserve the previous behavior where we never appended `.js` to relative module paths, set `output.tsConfigPath` to `off`.
10+
11+
```js
12+
export default {
13+
input: 'https://get.heyapi.dev/hey-api/backend',
14+
output: {
15+
path: 'src/client',
16+
tsConfigPath: 'off',
17+
},
18+
};
19+
```

docs/openapi-ts/migrating.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,22 @@ This config option is deprecated and will be removed in favor of [clients](./cli
2727

2828
This config option is deprecated and will be removed.
2929

30+
## v0.67.0
31+
32+
### Respecting `moduleResolution` value in `tsconfig.json`
33+
34+
This release introduces functionality related to your `tsconfig.json` file. The initial feature properly respects the value of your `moduleResolution` field. If you're using `nodenext`, the relative module paths in your output will be appended with `.js`. To preserve the previous behavior where we never appended `.js` to relative module paths, set `output.tsConfigPath` to `off`.
35+
36+
```js
37+
export default {
38+
input: 'https://get.heyapi.dev/hey-api/backend',
39+
output: {
40+
path: 'src/client',
41+
tsConfigPath: 'off', // [!code ++]
42+
},
43+
};
44+
```
45+
3046
## v0.66.0
3147

3248
### Read-only and write-only fields

packages/openapi-ts-tests/test/2.0.x.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,8 @@ describe(`OpenAPI ${version}`, () => {
340340
it.each(scenarios)('$description', async ({ config }) => {
341341
await createClient(config);
342342

343-
const outputPath = typeof config.output === 'string' ? config.output : '';
343+
const outputPath =
344+
typeof config.output === 'string' ? config.output : config.output.path;
344345
const filePaths = getFilePaths(outputPath);
345346

346347
await Promise.all(

packages/openapi-ts-tests/test/3.0.x.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,8 @@ describe(`OpenAPI ${version}`, () => {
579579
it.each(scenarios)('$description', async ({ config }) => {
580580
await createClient(config);
581581

582-
const outputPath = typeof config.output === 'string' ? config.output : '';
582+
const outputPath =
583+
typeof config.output === 'string' ? config.output : config.output.path;
583584
const filePaths = getFilePaths(outputPath);
584585

585586
await Promise.all(

packages/openapi-ts-tests/test/3.1.x.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,8 @@ describe(`OpenAPI ${version}`, () => {
709709
it.each(scenarios)('$description', async ({ config }) => {
710710
await createClient(config);
711711

712-
const outputPath = typeof config.output === 'string' ? config.output : '';
712+
const outputPath =
713+
typeof config.output === 'string' ? config.output : config.output.path;
713714
const filePaths = getFilePaths(outputPath);
714715

715716
await Promise.all(
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// This file is auto-generated by @hey-api/openapi-ts
2+
3+
import type { ClientOptions } from './types.gen.js';
4+
import { type Config, type ClientOptions as DefaultClientOptions, createClient, createConfig } from '@hey-api/client-axios';
5+
6+
/**
7+
* The `createClientConfig()` function will be called on client initialization
8+
* and the returned object will become the client's initial configuration.
9+
*
10+
* You may want to initialize your client this way instead of calling
11+
* `setConfig()`. This is useful for example if you're using Next.js
12+
* to ensure your client always has the correct values.
13+
*/
14+
export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>;
15+
16+
export const client = createClient(createConfig<ClientOptions>({
17+
baseURL: 'http://localhost:3000/base'
18+
}));
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// This file is auto-generated by @hey-api/openapi-ts
2+
export * from './types.gen.js';
3+
export * from './sdk.gen.js';

0 commit comments

Comments
 (0)