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
Copy file name to clipboardExpand all lines: packages/openapi-fetch/CONTRIBUTING.md
+10-8
Original file line number
Diff line number
Diff line change
@@ -2,19 +2,21 @@
2
2
3
3
Thanks for being willing to contribute! 🙏
4
4
5
-
**Working on your first Pull Request (PR)?**[Egghead has a great free video introduction](https://app.egghead.io/playlists/how-to-contribute-to-an-open-source-project-on-github).
5
+
**Working on your first Pull Request (PR)?**You can learn how from this free series [How to Contribute to an Open Source Project on GitHub](https://app.egghead.io/playlists/how-to-contribute-to-an-open-source-project-on-github).
6
6
7
7
## Open issues
8
8
9
-
Please check out the [the open issues](https://github.com/drwpow/openapi-typescript/issues). Issues labelled [**Good First Issue**](https://github.com/drwpow/openapi-typescript/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22)are especially good to start with.
9
+
Please check out the [the open issues](https://github.com/drwpow/openapi-typescript/issues). Issues labelled [**Good First Issue**](https://github.com/drwpow/openapi-typescript/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22)are especially good to start with.
10
10
11
-
Contributing doesn’t have to be in code! Simply answering questions in open issues, or providing workarounds, is just as important a contribution as making pull requests.
11
+
Contributing doesn’t have to be in code. Simply answering questions in open issues or providing workarounds is as important as making pull requests.
12
12
13
13
## Opening a Pull Request
14
14
15
-
Pull requests are **welcome** for this repo! Bugfixes will always be accepted, though in some cases some small changes may be requested.
15
+
Pull requests are **welcome** for this repo!
16
16
17
-
However, if adding a feature or breaking change, please **open an issue first to discuss.** This ensures no time or work is wasted writing code that won’t be accepted to the project (see [Project Goals](./README.md#-project-goals)). Undiscussed feature work may be rejected at the discretion of the maintainers.
17
+
Bugfixes will always be accepted, though in some cases some small changes may be requested.
18
+
19
+
However, if adding a feature or breaking change, please **open an issue first to discuss.** This ensures no time or work is wasted writing code that won’t be accepted to the project (see [Project Goals](https://openapi-ts.pages.dev/openapi-fetch/about/#project-goals)). Undiscussed feature work may be rejected at the discretion of the maintainers.
18
20
19
21
### Setup
20
22
@@ -24,7 +26,7 @@ However, if adding a feature or breaking change, please **open an issue first to
24
26
25
27
### Writing code
26
28
27
-
Create a new branch for your PR with `git checkout -b your-branch-name`. Add the relevant code as well as docs and tests. When you push everything up (`git push`), navigate back to your repo GitHub and you should see a prompt to open a new PR.
29
+
Create a new branch for your PR with `git checkout -b your-branch-name`. Add the relevant code as well as docs and tests. When you push everything up (`git push`), navigate back to your repo in GitHub and you should see a prompt to open a new PR.
28
30
29
31
While best practices for commit messages are encouraged (e.g. start with an imperative verb, keep it short, use the body if needed), this repo doesn’t follow any specific guidelines. Clarity is favored over strict rules. Changelogs are generated separately from git (see [the Changelogs section](#changelogs))
30
32
@@ -53,13 +55,13 @@ This library uses [Vitest](https://vitest.dev/) for testing. There’s a great [
Copy file name to clipboardExpand all lines: packages/openapi-typescript/CONTRIBUTING.md
+25-13
Original file line number
Diff line number
Diff line change
@@ -2,19 +2,21 @@
2
2
3
3
Thanks for being willing to contribute! 🙏
4
4
5
-
**Working on your first Pull Request (PR)?** You can learn how from this _free_ series [How to Contribute to an Open Source Project on GitHub](https://app.egghead.io/playlists/how-to-contribute-to-an-open-source-project-on-github)
5
+
**Working on your first Pull Request (PR)?** You can learn how from this free series [How to Contribute to an Open Source Project on GitHub](https://app.egghead.io/playlists/how-to-contribute-to-an-open-source-project-on-github).
6
6
7
7
## Open issues
8
8
9
-
Please check out the [the open issues](https://github.com/drwpow/openapi-typescript/issues). Issues labelled [**Good First Issue**](https://github.com/drwpow/openapi-typescript/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22)are especially good to start with.
9
+
Please check out the [the open issues](https://github.com/drwpow/openapi-typescript/issues). Issues labelled [**Good First Issue**](https://github.com/drwpow/openapi-typescript/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22)are especially good to start with.
10
10
11
-
Contributing doesn’t have to be in code! Simply answering questions in open issues, or providing workarounds, is just as important a contribution as making pull requests.
11
+
Contributing doesn’t have to be in code. Simply answering questions in open issues or providing workarounds is as important as making pull requests.
12
12
13
13
## Opening a Pull Request
14
14
15
-
Pull requests are **welcome** for this repo! Bugfixes will always be accepted, though in some cases some small changes may be requested.
15
+
Pull requests are **welcome** for this repo!
16
16
17
-
However, if adding a feature or breaking change, please **open an issue first to discuss.** This ensures no time or work is wasted writing code that won’t be accepted to the project (see [Project Goals](./README.md#-project-goals)). Undiscussed feature work may be rejected at the discretion of the maintainers.
17
+
Bugfixes will always be accepted, though in some cases some small changes may be requested.
18
+
19
+
However, if adding a feature or breaking change, please **open an issue first to discuss.** This ensures no time or work is wasted writing code that won’t be accepted to the project (see [Project Goals](https://openapi-ts.pages.dev/about/#project-goals)). Undiscussed feature work may be rejected at the discretion of the maintainers.
18
20
19
21
### Setup
20
22
@@ -24,14 +26,14 @@ However, if adding a feature or breaking change, please **open an issue first to
24
26
25
27
### Writing code
26
28
27
-
Create a new branch for your PR with `git checkout -b your-branch-name`. Add the relevant code as well as docs and tests. When you push everything up (`git push`), navigate back to your repo GitHub and you should see a prompt to open a new PR.
29
+
Create a new branch for your PR with `git checkout -b your-branch-name`. Add the relevant code as well as docs and tests. When you push everything up (`git push`), navigate back to your repo in GitHub and you should see a prompt to open a new PR.
28
30
29
31
While best practices for commit messages are encouraged (e.g. start with an imperative verb, keep it short, use the body if needed), this repo doesn’t follow any specific guidelines. Clarity is favored over strict rules. Changelogs are generated separately from git (see [the Changelogs section](#changelogs))
30
32
31
33
When working locally, run:
32
34
33
35
```bash
34
-
npm run dev
36
+
pnpm run dev
35
37
```
36
38
37
39
This will compile the code as you change automatically.
@@ -50,7 +52,7 @@ Contributing to this library is hard-bordering-on-impossible without a [test-dri
50
52
51
53
Reasoning about code generation can be quite difficult until you “invert your thinking” and approach it output-first. Adopting TDD can turn very unclear/abstract problems into concrete ones with clear steps to resolution.
52
54
53
-
✨ When starting any task, **write a failing test first!** ✨
55
+
TL;DR: When starting any task, **write a failing test first!**
54
56
55
57
#### Updating snapshot tests
56
58
@@ -71,7 +73,7 @@ When opening a pull request, make sure all of the following is done:
71
73
-[x] Tests pass (`npm test`)
72
74
-[x] Linting passes (`npm run lint`)
73
75
74
-
Lastly, be sure to fill out the complete PR template!
76
+
Lastly, be sure to fill out the complete PR template.
75
77
76
78
### Changelogs
77
79
@@ -94,13 +96,13 @@ This library uses [Vitest](https://vitest.dev/) for testing. There’s a great [
94
96
To run the entire test suite once, run:
95
97
96
98
```bash
97
-
npmtest
99
+
pnpmtest
98
100
```
99
101
100
102
To run an individual test:
101
103
102
104
```bash
103
-
npmtest -- [partial filename]
105
+
pnpmtest -- [partial filename]
104
106
```
105
107
106
108
To start the entire test suite in watch mode:
@@ -114,15 +116,15 @@ npx vitest
114
116
To run ESLint on the project:
115
117
116
118
```bash
117
-
npm run lint
119
+
pnpm run lint
118
120
```
119
121
120
122
### Updating snapshot examples
121
123
122
124
⚠️ This may break tests if schemas have been updated
123
125
124
126
```bash
125
-
npm run update:examples
127
+
pnpm run update:examples
126
128
```
127
129
128
130
### Unit tests or snapshot tests?
@@ -134,3 +136,13 @@ This library has both unit tests (tests that test a tiny part of a schema) and s
134
136
- Adding a CLI option that changes the entire output
135
137
136
138
For most PRs, **snapshot tests can be avoided.** But for scenarios similar to the ones mentioned, they can ensure everything is working as expected.
139
+
140
+
## Troubleshooting
141
+
142
+
### When I run tests, it’s not picking up my changes
143
+
144
+
Be sure to run `pnpm run build` to build the project. Most tests actually test the **compiled JS**, not the source TypeScript. It’s recommended to run `pnpm run dev` as you work so changes are always up-to-date.
145
+
146
+
### I get an obscure error when testing against my schema
147
+
148
+
Be sure your schema passes [Redocly lint](https://redocly.com/docs/cli/commands/lint/). Remember this library requires already-validated OpenAPI schemas, so even subtle errors will throw.
0 commit comments