Skip to content

Commit c8708e2

Browse files
duncanbeeversdrwpowopenapi-ts-botgithub-actions[bot]
authored
Fix colliding enumValues exports (#2051)
* Add schema to postTransform options (#2049) * Add schema to postTransform options Closes #2013 * fixup! Add schema to postTransform options Closes #2013 * fixup! Add schema to postTransform options Closes #2013 * fixup! Add schema to postTransform options * Add Netlify badge (#2065) * Only check GitHub token for docs build when update needed * Add Netlify badge * Use link * [ci] release (#2084) Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * Fix issue templates (#2088) * Add feat issues to projects (#2090) * Use const arrays for OpenAPI enum types Preserve capitalization of named, exported enum values. Type exported const values as const, instead of their ___location within the operations or components schemas. Derive and export types for enum values from concrete values in const arrays. Use derived enum value types in operations and components schemas. Use non-conflicting variable names for composed OpenAPI enums (anyOf: [enum1, enum2]) * Export type-predicates along when enumValues is true --------- Co-authored-by: Drew Powers <[email protected]> Co-authored-by: openapi-ts-bot <[email protected]> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 6a08b34 commit c8708e2

31 files changed

+802
-309
lines changed

.changeset/shaggy-impalas-develop.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"openapi-typescript": major
3+
---
4+
5+
Export enumValues as const arrays. Derive schema types from literal values.

.github/ISSUE_TEMPLATE/01_openapi-typescript-bug.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,21 @@ labels:
66
- triage
77
body:
88
- type: input
9+
id: version
910
attributes:
1011
label: openapi-typescript version
1112
placeholder: x.x.x
1213
validations:
1314
required: true
1415
- type: input
16+
id: node
1517
attributes:
1618
label: Node.js version
1719
placeholder: 20.x.x
1820
validations:
1921
required: true
2022
- type: input
23+
id: os
2124
attributes:
2225
label: OS + version
2326
placeholder: macOS 15.1.1
@@ -45,14 +48,14 @@ body:
4548
required: true
4649
- type: checkboxes
4750
id: required
48-
label: Required
4951
attributes:
52+
label: Required
5053
options:
5154
- label: My OpenAPI schema is valid and passes the [Redocly validator](https://redocly.com/docs/cli/commands/lint/) (`npx @redocly/cli@latest lint`)
5255
required: true
5356
- type: checkboxes
5457
id: extra
55-
label: Extra
5658
attributes:
59+
label: Extra
5760
options:
5861
- label: I’m willing to open a PR (see [CONTRIBUTING.md](https://github.com/openapi-ts/openapi-typescript/blob/main/packages/openapi-typescript/CONTRIBUTING.md))

.github/ISSUE_TEMPLATE/01_openapi-typescript-feat.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
name: "openapi-typescript: Feature request"
22
description: Propose new functionality or a breaking change
3-
title: ""
43
labels:
54
- openapi-ts
65
- enhancement
6+
projects:
7+
- openapi-ts/2
78
body:
89
- type: textarea
910
id: description
@@ -21,7 +22,7 @@ body:
2122
required: true
2223
- type: checkboxes
2324
id: extra
24-
label: Extra
2525
attributes:
26+
label: Extra
2627
options:
2728
- label: I’m willing to open a PR (see [CONTRIBUTING.md](https://github.com/openapi-ts/openapi-typescript/blob/main/packages/openapi-typescript/CONTRIBUTING.md))

.github/ISSUE_TEMPLATE/02_openapi-fetch-bug.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ labels:
66
- triage
77
body:
88
- type: input
9+
id: version
910
attributes:
10-
label: Version
11+
label: openapi-fetch version
1112
placeholder: x.x.x
1213
validations:
1314
required: true
@@ -33,7 +34,7 @@ body:
3334
required: true
3435
- type: checkboxes
3536
id: extra
36-
label: Extra
3737
attributes:
38+
label: Extra
3839
options:
3940
- label: I’m willing to open a PR (see [CONTRIBUTING.md](https://github.com/openapi-ts/openapi-typescript/blob/main/packages/openapi-fetch/CONTRIBUTING.md))

.github/ISSUE_TEMPLATE/02_openapi-fetch-feat.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
name: "openapi-fetch: Feature request"
22
description: Propose new functionality or a breaking change
3-
title: ""
43
labels:
54
- openapi-fetch
65
- enhancement
6+
projects:
7+
- openapi-ts/3
78
body:
89
- type: textarea
910
id: description
@@ -21,7 +22,7 @@ body:
2122
required: true
2223
- type: checkboxes
2324
id: extra
24-
label: Extra
2525
attributes:
26+
label: Extra
2627
options:
2728
- label: I’m willing to open a PR (see [CONTRIBUTING.md](https://github.com/openapi-ts/openapi-typescript/blob/main/packages/openapi-fetch/CONTRIBUTING.md))

.github/ISSUE_TEMPLATE/03_openapi-react-query-bug.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ labels:
66
- triage
77
body:
88
- type: input
9+
id: version
910
attributes:
10-
label: Version
11+
label: openapi-react-query version
1112
placeholder: x.x.x
1213
validations:
1314
required: true
@@ -26,14 +27,15 @@ body:
2627
validations:
2728
required: true
2829
- type: textarea
30+
id: expected
2931
attributes:
3032
label: Expected result
3133
description: (In case it’s not obvious)
3234
validations:
3335
required: true
3436
- type: checkboxes
3537
id: extra
36-
label: Extra
3738
attributes:
39+
label: Extra
3840
options:
3941
- label: I’m willing to open a PR (see [CONTRIBUTING.md](https://github.com/openapi-ts/openapi-typescript/blob/main/packages/openapi-react-query/CONTRIBUTING.md))

.github/ISSUE_TEMPLATE/03_openapi-react-query-feat.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
name: "openapi-react-query: Feature request"
22
description: Propose new functionality or a breaking change
3-
title: ""
43
labels:
54
- openapi-react-query
65
- enhancement
@@ -21,7 +20,7 @@ body:
2120
required: true
2221
- type: checkboxes
2322
id: extra
24-
label: Extra
2523
attributes:
24+
label: Extra
2625
options:
2726
- label: I’m willing to open a PR (see [CONTRIBUTING.md](https://github.com/openapi-ts/openapi-typescript/blob/main/packages/openapi-react-query/CONTRIBUTING.md))

.github/ISSUE_TEMPLATE/04_swr-openapi-bug.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ labels:
55
- bug
66
body:
77
- type: input
8+
id: version
89
attributes:
9-
label: Version
10+
label: swr-openapi version
1011
placeholder: x.x.x
1112
validations:
1213
required: true
@@ -25,14 +26,15 @@ body:
2526
validations:
2627
required: true
2728
- type: textarea
29+
id: expected
2830
attributes:
2931
label: Expected result
3032
description: (In case it’s not obvious)
3133
validations:
3234
required: true
3335
- type: checkboxes
3436
id: extra
35-
label: Extra
3637
attributes:
38+
label: Extra
3739
options:
3840
- label: I’m willing to open a PR (see [CONTRIBUTING.md](https://github.com/openapi-ts/openapi-typescript/blob/main/packages/swr-openapi/CONTRIBUTING.md))

.github/ISSUE_TEMPLATE/04_swr-openapi-feat.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
name: "swr-openapi: Feature request"
22
description: Propose new functionality or a breaking change
3-
title: ""
43
labels:
54
- swr-openapi
65
- enhancement
@@ -21,7 +20,7 @@ body:
2120
required: true
2221
- type: checkboxes
2322
id: extra
24-
label: Extra
2523
attributes:
24+
label: Extra
2625
options:
2726
- label: I’m willing to open a PR (see [CONTRIBUTING.md](https://github.com/openapi-ts/openapi-typescript/blob/main/packages/swr-openapi/CONTRIBUTING.md))

docs/.vitepress/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import zh from "./zh";
44
import ja from "./ja";
55
import shared from "./shared";
66
import { transformerTwoslash } from "@shikijs/vitepress-twoslash";
7-
import { ModuleKind, ModuleResolutionKind } from "typescript";
7+
import { ModuleResolutionKind } from "typescript";
88

99
// https://vitepress.dev/reference/site-config
1010
export default defineConfig({

0 commit comments

Comments
 (0)