Skip to content

Commit a41b883

Browse files
authored
Merge branch 'main' into fix/discriminator-non-string-type-support
2 parents 53413ef + bb53a98 commit a41b883

207 files changed

Lines changed: 6499 additions & 7903 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/brown-ideas-matter.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@hey-api/shared": patch
3+
---
4+
5+
**internal**: export schema walker interfaces

.changeset/clean-singers-stand.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"@hey-api/openapi-ts": minor
3+
---
4+
5+
**plugin(valibot)**: remove `enum.nodes.nullable` resolver node
6+
7+
### Removed resolver node
8+
9+
Valibot plugin no longer exposes the `enum.nodes.nullable` node. It was refactored so that nullable values are handled outside of resolvers.

.changeset/ninety-towns-act.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"@hey-api/openapi-ts": minor
3+
---
4+
5+
**plugin(zod)**: remove `enum.nodes.nullable` resolver node
6+
7+
### Removed resolver node
8+
9+
Zod plugin no longer exposes the `enum.nodes.nullable` node. It was refactored so that nullable values are handled outside of resolvers.

.changeset/proud-trains-lay.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@hey-api/openapi-ts": patch
3+
---
4+
5+
**plugin(zod)**: use `.nullable()` and `.nullish()` methods

.changeset/stale-falcons-raise.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@hey-api/openapi-ts": patch
3+
---
4+
5+
**plugin(valibot)**: use `.nullable()` and `.nullish()` methods

dev/inputs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import path from 'node:path';
33
import { getSpecsPath } from '../packages/openapi-ts-tests/utils';
44

55
export const inputs = {
6-
circular: path.resolve(getSpecsPath(), '3.1.x', 'circular.yaml'),
6+
circular: path.resolve(getSpecsPath(), '3.0.x', 'circular.yaml'),
77
full: path.resolve(getSpecsPath(), '3.1.x', 'full.yaml'),
88
local: 'http://localhost:8000/openapi.json',
99
opencode: path.resolve(getSpecsPath(), '3.1.x', 'opencode.yaml'),

dev/python/plugins.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ import type { UserConfig } from '@hey-api/openapi-python';
33
type PluginConfig = NonNullable<NonNullable<UserConfig['plugins']>[number]>;
44

55
export function sdk(
6-
options?: Partial<Omit<Extract<PluginConfig, { name: '@hey-api/python-sdk' }>, 'name'>>,
7-
) {
6+
options?: Omit<Extract<PluginConfig, { name: '@hey-api/python-sdk' }>, 'name'>,
7+
): Extract<PluginConfig, { name: '@hey-api/python-sdk' }> {
88
return {
99
name: '@hey-api/python-sdk' as const,
1010
...options,
1111
};
1212
}
1313

1414
export function pydantic(
15-
options?: Partial<Omit<Extract<PluginConfig, { name: 'pydantic' }>, 'name'>>,
16-
) {
15+
options?: Omit<Extract<PluginConfig, { name: 'pydantic' }>, 'name'>,
16+
): Extract<PluginConfig, { name: 'pydantic' }> {
1717
return {
1818
name: 'pydantic' as const,
1919
...options,

dev/typescript/plugins.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,51 +3,53 @@ import type { UserConfig } from '@hey-api/openapi-ts';
33
type PluginConfig = NonNullable<NonNullable<UserConfig['plugins']>[number]>;
44

55
export function typescript(
6-
options?: Partial<Omit<Extract<PluginConfig, { name: '@hey-api/typescript' }>, 'name'>>,
7-
) {
6+
options?: Omit<Extract<PluginConfig, { name: '@hey-api/typescript' }>, 'name'>,
7+
): Extract<PluginConfig, { name: '@hey-api/typescript' }> {
88
return {
99
name: '@hey-api/typescript' as const,
1010
...options,
1111
};
1212
}
1313

1414
export function sdk(
15-
options?: Partial<Omit<Extract<PluginConfig, { name: '@hey-api/sdk' }>, 'name'>>,
16-
) {
15+
options?: Omit<Extract<PluginConfig, { name: '@hey-api/sdk' }>, 'name'>,
16+
): Extract<PluginConfig, { name: '@hey-api/sdk' }> {
1717
return {
1818
name: '@hey-api/sdk' as const,
1919
...options,
2020
};
2121
}
2222

23-
export function zod(options?: Partial<Omit<Extract<PluginConfig, { name: 'zod' }>, 'name'>>) {
23+
export function zod(
24+
options?: Omit<Extract<PluginConfig, { name: 'zod' }>, 'name'>,
25+
): Extract<PluginConfig, { name: 'zod' }> {
2426
return {
2527
name: 'zod' as const,
2628
...options,
2729
};
2830
}
2931

3032
export function valibot(
31-
options?: Partial<Omit<Extract<PluginConfig, { name: 'valibot' }>, 'name'>>,
32-
) {
33+
options?: Omit<Extract<PluginConfig, { name: 'valibot' }>, 'name'>,
34+
): Extract<PluginConfig, { name: 'valibot' }> {
3335
return {
3436
name: 'valibot' as const,
3537
...options,
3638
};
3739
}
3840

3941
export function tanstackReactQuery(
40-
options?: Partial<Omit<Extract<PluginConfig, { name: '@tanstack/react-query' }>, 'name'>>,
41-
) {
42+
options?: Omit<Extract<PluginConfig, { name: '@tanstack/react-query' }>, 'name'>,
43+
): Extract<PluginConfig, { name: '@tanstack/react-query' }> {
4244
return {
4345
name: '@tanstack/react-query' as const,
4446
...options,
4547
};
4648
}
4749

4850
export function transformers(
49-
options?: Partial<Omit<Extract<PluginConfig, { name: '@hey-api/transformers' }>, 'name'>>,
50-
) {
51+
options?: Omit<Extract<PluginConfig, { name: '@hey-api/transformers' }>, 'name'>,
52+
): Extract<PluginConfig, { name: '@hey-api/transformers' }> {
5153
return {
5254
name: '@hey-api/transformers' as const,
5355
...options,

docs/openapi-ts/migrating.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ description: Migrating to @hey-api/openapi-ts.
77

88
While we try to avoid breaking changes, sometimes it's unavoidable in order to offer you the latest features. This page lists changes that require updates to your code. If you run into a problem with migration, please [open an issue](https://github.com/hey-api/openapi-ts/issues).
99

10+
## v0.93.0
11+
12+
### Removed resolver node
13+
14+
Valibot and Zod plugins no longer expose the `enum.nodes.nullable` node. Both plugins were refactored so that nullable values are handled outside of resolvers.
15+
1016
## v0.92.0
1117

1218
### Updated Symbol interface

packages/openapi-python/src/plugins/pydantic/shared/export.ts

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,36 @@
1-
import type { Symbol } from '@hey-api/codegen-core';
2-
import type { IR } from '@hey-api/shared';
1+
import { applyNaming, pathToName } from '@hey-api/shared';
32

43
// import { createSchemaComment } from '../../../plugins/shared/utils/schema';
54
import { $ } from '../../../py-dsl';
5+
import type { ProcessorContext } from './processor';
66
// import { identifiers } from '../v2/constants';
77
// import { pipesToNode } from './pipes';
88
import type { Ast, IrSchemaToAstOptions } from './types';
99

1010
export function exportAst({
11-
// ast,
11+
meta,
12+
naming,
13+
namingAnchor,
14+
path,
1215
plugin,
13-
// schema,
14-
// state,
15-
symbol,
16-
}: IrSchemaToAstOptions & {
17-
ast: Ast;
18-
schema: IR.SchemaObject;
19-
symbol: Symbol;
20-
}): void {
21-
// const v = plugin.external('valibot.v');
22-
const classDef = $.class(symbol);
16+
tags,
17+
}: Pick<IrSchemaToAstOptions, 'state'> &
18+
ProcessorContext & {
19+
ast: Ast;
20+
}): void {
21+
const name = pathToName(path, { anchor: namingAnchor });
22+
const symbol = plugin.symbol(applyNaming(name, naming), {
23+
meta: {
24+
category: 'schema',
25+
path,
26+
tags,
27+
tool: 'pydantic',
28+
...meta,
29+
},
30+
});
31+
32+
const baseModel = plugin.external('pydantic.BaseModel');
33+
const classDef = $.class(symbol).extends(baseModel);
2334
// .export()
2435
// .$if(plugin.config.comments && createSchemaComment(schema), (c, v) => c.doc(v))
2536
// .$if(state.hasLazyExpression['~ref'], (c) =>

0 commit comments

Comments
 (0)