You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* 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>
Copy file name to clipboardexpand all lines: .github/ISSUE_TEMPLATE/01_openapi-typescript-bug.yml
+5-2
Original file line number
Diff line number
Diff line change
@@ -6,18 +6,21 @@ labels:
6
6
- triage
7
7
body:
8
8
- type: input
9
+
id: version
9
10
attributes:
10
11
label: openapi-typescript version
11
12
placeholder: x.x.x
12
13
validations:
13
14
required: true
14
15
- type: input
16
+
id: node
15
17
attributes:
16
18
label: Node.js version
17
19
placeholder: 20.x.x
18
20
validations:
19
21
required: true
20
22
- type: input
23
+
id: os
21
24
attributes:
22
25
label: OS + version
23
26
placeholder: macOS 15.1.1
@@ -45,14 +48,14 @@ body:
45
48
required: true
46
49
- type: checkboxes
47
50
id: required
48
-
label: Required
49
51
attributes:
52
+
label: Required
50
53
options:
51
54
- label: My OpenAPI schema is valid and passes the [Redocly validator](https://redocly.com/docs/cli/commands/lint/) (`npx @redocly/cli@latest lint`)
52
55
required: true
53
56
- type: checkboxes
54
57
id: extra
55
-
label: Extra
56
58
attributes:
59
+
label: Extra
57
60
options:
58
61
- 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))
Copy file name to clipboardexpand all lines: .github/ISSUE_TEMPLATE/01_openapi-typescript-feat.yml
+3-2
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,10 @@
1
1
name: "openapi-typescript: Feature request"
2
2
description: Propose new functionality or a breaking change
3
-
title: ""
4
3
labels:
5
4
- openapi-ts
6
5
- enhancement
6
+
projects:
7
+
- openapi-ts/2
7
8
body:
8
9
- type: textarea
9
10
id: description
@@ -21,7 +22,7 @@ body:
21
22
required: true
22
23
- type: checkboxes
23
24
id: extra
24
-
label: Extra
25
25
attributes:
26
+
label: Extra
26
27
options:
27
28
- 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))
Copy file name to clipboardexpand all lines: .github/ISSUE_TEMPLATE/02_openapi-fetch-bug.yml
+3-2
Original file line number
Diff line number
Diff line change
@@ -6,8 +6,9 @@ labels:
6
6
- triage
7
7
body:
8
8
- type: input
9
+
id: version
9
10
attributes:
10
-
label: Version
11
+
label: openapi-fetch version
11
12
placeholder: x.x.x
12
13
validations:
13
14
required: true
@@ -33,7 +34,7 @@ body:
33
34
required: true
34
35
- type: checkboxes
35
36
id: extra
36
-
label: Extra
37
37
attributes:
38
+
label: Extra
38
39
options:
39
40
- 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))
Copy file name to clipboardexpand all lines: .github/ISSUE_TEMPLATE/02_openapi-fetch-feat.yml
+3-2
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,10 @@
1
1
name: "openapi-fetch: Feature request"
2
2
description: Propose new functionality or a breaking change
3
-
title: ""
4
3
labels:
5
4
- openapi-fetch
6
5
- enhancement
6
+
projects:
7
+
- openapi-ts/3
7
8
body:
8
9
- type: textarea
9
10
id: description
@@ -21,7 +22,7 @@ body:
21
22
required: true
22
23
- type: checkboxes
23
24
id: extra
24
-
label: Extra
25
25
attributes:
26
+
label: Extra
26
27
options:
27
28
- 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))
Copy file name to clipboardexpand all lines: .github/ISSUE_TEMPLATE/03_openapi-react-query-bug.yml
+4-2
Original file line number
Diff line number
Diff line change
@@ -6,8 +6,9 @@ labels:
6
6
- triage
7
7
body:
8
8
- type: input
9
+
id: version
9
10
attributes:
10
-
label: Version
11
+
label: openapi-react-query version
11
12
placeholder: x.x.x
12
13
validations:
13
14
required: true
@@ -26,14 +27,15 @@ body:
26
27
validations:
27
28
required: true
28
29
- type: textarea
30
+
id: expected
29
31
attributes:
30
32
label: Expected result
31
33
description: (In case it’s not obvious)
32
34
validations:
33
35
required: true
34
36
- type: checkboxes
35
37
id: extra
36
-
label: Extra
37
38
attributes:
39
+
label: Extra
38
40
options:
39
41
- 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))
Copy file name to clipboardexpand all lines: .github/ISSUE_TEMPLATE/03_openapi-react-query-feat.yml
+1-2
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,5 @@
1
1
name: "openapi-react-query: Feature request"
2
2
description: Propose new functionality or a breaking change
3
-
title: ""
4
3
labels:
5
4
- openapi-react-query
6
5
- enhancement
@@ -21,7 +20,7 @@ body:
21
20
required: true
22
21
- type: checkboxes
23
22
id: extra
24
-
label: Extra
25
23
attributes:
24
+
label: Extra
26
25
options:
27
26
- 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))
Copy file name to clipboardexpand all lines: .github/ISSUE_TEMPLATE/04_swr-openapi-bug.yml
+4-2
Original file line number
Diff line number
Diff line change
@@ -5,8 +5,9 @@ labels:
5
5
- bug
6
6
body:
7
7
- type: input
8
+
id: version
8
9
attributes:
9
-
label: Version
10
+
label: swr-openapi version
10
11
placeholder: x.x.x
11
12
validations:
12
13
required: true
@@ -25,14 +26,15 @@ body:
25
26
validations:
26
27
required: true
27
28
- type: textarea
29
+
id: expected
28
30
attributes:
29
31
label: Expected result
30
32
description: (In case it’s not obvious)
31
33
validations:
32
34
required: true
33
35
- type: checkboxes
34
36
id: extra
35
-
label: Extra
36
37
attributes:
38
+
label: Extra
37
39
options:
38
40
- 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))
Copy file name to clipboardexpand all lines: .github/ISSUE_TEMPLATE/04_swr-openapi-feat.yml
+1-2
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,5 @@
1
1
name: "swr-openapi: Feature request"
2
2
description: Propose new functionality or a breaking change
3
-
title: ""
4
3
labels:
5
4
- swr-openapi
6
5
- enhancement
@@ -21,7 +20,7 @@ body:
21
20
required: true
22
21
- type: checkboxes
23
22
id: extra
24
-
label: Extra
25
23
attributes:
24
+
label: Extra
26
25
options:
27
26
- 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))
Copy file name to clipboardexpand all lines: docs/.vitepress/en.ts
+1-1
Original file line number
Diff line number
Diff line change
@@ -139,7 +139,7 @@ export default defineConfig({
139
139
],
140
140
footer: {
141
141
message:
142
-
'Released under the <a href="https://github.com/openapi-ts/openapi-typescript/blob/main/packages/openapi-typescript/LICENSE">MIT License</a>.',
142
+
'Released under the <a href="https://github.com/openapi-ts/openapi-typescript/blob/main/packages/openapi-typescript/LICENSE">MIT License</a>. Powered by <a href="https://netlify.com">Netlify</a>.',
Copy file name to clipboardexpand all lines: docs/6.x/node.md
+12-2
Original file line number
Diff line number
Diff line change
@@ -122,6 +122,16 @@ Resultant diff with correctly-typed `file` property:
122
122
+ file?:Blob;
123
123
```
124
124
125
-
Any [Schema Object](https://spec.openapis.org/oas/latest.html#schema-object) present in your schema will be run through this formatter (even remote ones!). Also be sure to check the `metadata` parameter for additional context that may be helpful.
125
+
#### transform / postTransform metadata
126
126
127
-
There are many other uses for this besides checking `format`. Because this must return a **string** you can produce any arbitrary TypeScript code you’d like (even your own custom types).
127
+
Any [Schema Object](https://spec.openapis.org/oas/latest.html#schema-object) present in your schema will be run through `transform`, prior to its conversion to a TypeScript AST node, and `postTransform` after its conversion, including remote schemas!
128
+
129
+
The `metadata` parameter present on both `transform` and `postTransform` has additional context that may be helpful.
130
+
131
+
| Property | Description |
132
+
|-|-|
133
+
| `metadata.path` | A [`$ref`](https://json-schema.org/understanding-json-schema/structuring#dollarref) URI string, pointing to the current schema object |
134
+
| `metadata.schema` | The schema object being transformed (only present for `postTransform`) |
135
+
| `metadata.ctx` | The GlobalContext object, containing
136
+
137
+
There are many other uses for this besides checking `format`. Because `tranform` may return a **string** you can produce any arbitrary TypeScript code you’d like (even your own custom types).
Copy file name to clipboardexpand all lines: docs/scripts/update-contributors.js
+12-17
Original file line number
Diff line number
Diff line change
@@ -7,11 +7,14 @@ const data = JSON.parse(fs.readFileSync(CONTRIBUTORS_JSON, "utf8"));
7
7
8
8
constONE_WEEK=1000*60*60*24;
9
9
10
-
constGITHUB_TOKEN=process.env.GITHUB_TOKEN;
11
-
if(!GITHUB_TOKEN){
12
-
thrownewError(
13
-
'GITHUB_TOKEN not set! Create a token with "read:user" scope and set as an environment variable.\nhttps://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-personal-access-token-classic',
14
-
);
10
+
functiongetGitHubToken(){
11
+
constGITHUB_TOKEN=process.env.GITHUB_TOKEN;
12
+
if(!GITHUB_TOKEN){
13
+
thrownewError(
14
+
'GITHUB_TOKEN not set! Create a token with "read:user" scope and set as an environment variable.\nhttps://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-personal-access-token-classic',
15
+
);
16
+
}
17
+
returnGITHUB_TOKEN;
15
18
}
16
19
17
20
classUserFetchErrorextendsError{
@@ -37,7 +40,7 @@ async function fetchUserInfo(username) {
);// update file while fetching (sync happens safely in between fetches)
220
+
fs.writeFileSync(newURL("../data/contributors.json",import.meta.url),JSON.stringify(data));// update file while fetching (sync happens safely in between fetches)
226
221
}catch(err){
227
222
if(errinstanceofUserFetchError&&err.notFound){
228
223
console.warn(`[${i}/${total}] (Skipped ${username}, not found)`);
0 commit comments