Skip to content

Commit cb8b7a9

Browse files
authored
Merge branch 'main' into copilot/fix-2651
2 parents e537339 + 10c13de commit cb8b7a9

File tree

11 files changed

+113
-1
lines changed

11 files changed

+113
-1
lines changed
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+
fix(parser): expand schema deduplication by including validation constraints in type ID
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"openapi": "3.1.0",
3+
"info": {
4+
"title": "String Constraints Union Test",
5+
"version": "1.0.0"
6+
},
7+
"components": {
8+
"schemas": {
9+
"LocaleOrLanguage": {
10+
"anyOf": [
11+
{
12+
"type": "string",
13+
"minLength": 5,
14+
"maxLength": 5,
15+
"description": "Combination of ISO 639-1 and ISO 3166-1 alpha-2 separated by a hyphen."
16+
},
17+
{
18+
"type": "string",
19+
"minLength": 2,
20+
"maxLength": 2,
21+
"description": "ISO 639-1 language code."
22+
}
23+
]
24+
}
25+
}
26+
}
27+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// This file is auto-generated by @hey-api/openapi-ts
2+
3+
import * as z from 'zod/v4-mini';
4+
5+
export const zLocaleOrLanguage = z.union([
6+
z.string().check(z.length(5)),
7+
z.string().check(z.length(2))
8+
]);
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// This file is auto-generated by @hey-api/openapi-ts
2+
3+
import { z } from 'zod';
4+
5+
export const zLocaleOrLanguage = z.union([
6+
z.string().length(5),
7+
z.string().length(2)
8+
]);
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// This file is auto-generated by @hey-api/openapi-ts
2+
3+
import { z } from 'zod/v4';
4+
5+
export const zLocaleOrLanguage = z.union([
6+
z.string().length(5),
7+
z.string().length(2)
8+
]);

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,13 @@ for (const zodVersion of zodVersions) {
138138
description:
139139
"validator schemas with merged unions (can't use .merge())",
140140
},
141+
{
142+
config: createConfig({
143+
input: 'validators-string-constraints-union.json',
144+
output: 'validators-string-constraints-union',
145+
}),
146+
description: 'validator schemas with string constraints union',
147+
},
141148
];
142149

143150
it.each(scenarios)('$description', async ({ config }) => {
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// This file is auto-generated by @hey-api/openapi-ts
2+
3+
import * as z from 'zod/mini';
4+
5+
export const zLocaleOrLanguage = z.union([
6+
z.string().check(z.length(5)),
7+
z.string().check(z.length(2))
8+
]);
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// This file is auto-generated by @hey-api/openapi-ts
2+
3+
import { z } from 'zod/v3';
4+
5+
export const zLocaleOrLanguage = z.union([
6+
z.string().length(5),
7+
z.string().length(2)
8+
]);
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// This file is auto-generated by @hey-api/openapi-ts
2+
3+
import { z } from 'zod';
4+
5+
export const zLocaleOrLanguage = z.union([
6+
z.string().length(5),
7+
z.string().length(2)
8+
]);

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,13 @@ for (const zodVersion of zodVersions) {
138138
description:
139139
"validator schemas with merged unions (can't use .merge())",
140140
},
141+
{
142+
config: createConfig({
143+
input: 'validators-string-constraints-union.json',
144+
output: 'validators-string-constraints-union',
145+
}),
146+
description: 'validator schemas with string constraints union',
147+
},
141148
];
142149

143150
it.each(scenarios)('$description', async ({ config }) => {

0 commit comments

Comments
 (0)