Skip to content

Commit 0d79258

Browse files
committed
docs(openapi-metadata): README, CONTRIBUTING and LICENSE file
1 parent 0917709 commit 0d79258

File tree

3 files changed

+131
-0
lines changed

3 files changed

+131
-0
lines changed
+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Contributing
2+
3+
Thanks for being willing to contribute! 🙏
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).
6+
7+
## Open issues
8+
9+
Please check out the [the open issues](https://github.com/openapi-ts/openapi-typescript/issues). Issues labelled [**Good First Issue**](https://github.com/openapi-ts/openapi-typescript/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) are especially good to start with.
10+
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+
13+
## Writing code
14+
15+
### Setup
16+
17+
1. Install [pnpm](https://pnpm.io/)
18+
2. [Fork this repo](https://docs.github.com/en/get-started/quickstart/fork-a-repo) and clone your copy locally
19+
3. Run `pnpm i` to install dependencies
20+
21+
### Testing
22+
23+
This library uses [Vitest](https://vitest.dev/) for testing. There’s a great [VS Code extension](https://marketplace.visualstudio.com/items?itemName=ZixuanChen.vitest-explorer) you can optionally use if you’d like in-editor debugging tools.
24+
25+
To run the entire test suite, run:
26+
27+
```bash
28+
pnpm test
29+
```
30+
31+
To run an individual test:
32+
33+
```bash
34+
pnpm test -- [partial filename]
35+
```
36+
37+
To start the entire test suite in watch mode:
38+
39+
```bash
40+
npx vitest
41+
```
42+
43+
#### TypeScript tests
44+
45+
**Don’t neglect writing TS tests!** In the test suite, you’ll see `// @ts-expect-error` comments. These are critical tests in and of themselves—they are asserting that TypeScript throws an error when it should be throwing an error (the test suite will actually fail in places if a TS error is _not_ raised).
46+
47+
As this is just a minimal fetch wrapper meant to provide deep type inference for API schemas, **testing TS types** is arguably more important than testing the runtime. So please make liberal use of `// @ts-expect-error`, and as a general rule of thumb, write more **unwanted** output tests than _wanted_ output tests.
48+
49+
### Running linting
50+
51+
Linting is handled via [Biome](https://biomejs.dev), a faster ESLint replacement. It was installed with `pnpm i` and can be run with:
52+
53+
```bash
54+
pnpm run lint
55+
```
56+
57+
### Changelogs
58+
59+
The changelog is generated via [changesets](https://github.com/changesets/changesets), and is separate from Git commit messages and pull request titles. To write a human-readable changelog for your changes, run:
60+
61+
```
62+
npx changeset
63+
```
64+
65+
This will ask if it’s a `patch`, `minor`, or `major` change ([semver](https://semver.org/)), along with a plain description of what you did. Commit this new file along with the rest of your PR, and during the next release this will go into the official changelog!
66+
67+
## Opening a Pull Request
68+
69+
Pull requests are **welcome** for this repo!
70+
71+
Bugfixes will always be accepted, though in some cases some small changes may be requested.
72+
73+
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.dev/openapi-fetch/about/#project-goals)). Undiscussed feature work may be rejected at the discretion of the maintainers.
74+
75+
### Writing the commit
76+
77+
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.
78+
79+
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)).
80+
81+
### Writing the PR notes
82+
83+
**Please fill out the template!** It’s a very lightweight template 🙂.
84+
85+
### Adding docs
86+
87+
If you added a feature, or changed how something worked, please [update the docs](../../docs/)!
88+
89+
### Passing CI
90+
91+
All PRs must fix lint errors, and all tests must pass. PRs will not be merged until all CI checks are “green” (✅).

packages/openapi-metadata/LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Drew Powers
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

packages/openapi-metadata/README.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# openapi-metadata
2+
3+
`openapi-metadata` is a framework agnostic library to automatically generate OpenAPI schemas and documentation by using Typescript decorators and metadata.
4+
5+
- ✅ Fully compliant [OpenAPI V3](https://swagger.io/specification/)
6+
- ✅ Automatic type inference
7+
- ✅ Supports [Scalar](https://scalar.com/), [Swagger UI](https://swagger.io/tools/swagger-ui/) and [Rapidoc](https://rapidocweb.com/)
8+
- ✅ Extensible with custom type loaders
9+
- ✅ Ready to be integrated with your favorite framework
10+
11+
## Installation
12+
13+
```bash
14+
npm i openapi-metadata reflect-metadata
15+
```
16+
17+
## 📓 Docs
18+
19+
[View Docs](https://openapi-ts.dev/openapi-metadata/)

0 commit comments

Comments
 (0)