Thanks for being willing to contribute!
Working on your first Pull Request? You can learn how from this free series How to Contribute to an Open Source Project on GitHub
- Install pnpm
- Fork and clone the repo
- Run
pnpm i
to install dependencies - Create a branch for your PR with
git checkout -b pr/your-branch-name
It’s also recommended you have ESLint installed and set up correctly. You may also run the command
npm run lint
to see lint errors.
Tip: Keep your
main
branch pointing at the original repository and make pull requests from branches on your fork. To do this, run:git remote add upstream https://github.com/drwpow/openapi-typescript.git git fetch upstream git branch --set-upstream-to=upstream/main main
This will add the original repository as a "remote" called "upstream," Then fetch the git information from that remote, then set your local
main
branch to use the upstream main branch whenever you rungit pull
. Then you can make all of your pull request branches based on thismain
branch. Whenever you want to update your version ofmain
, do a regulargit pull
.
Please make sure to run the tests (npm test
) before you commit your changes.
This repo supports OpenAPI 2.0 and 3.0. There are some real-world examples located in tests/v2/specs/*.yaml
and
tests/v3/specs/*.yaml
, respectively. Testing large, real schemas was a major goal of this project. Many libraries only
test the “Petstore” example from Swagger, which is contrived and is missing much complexity from companies’ production
schemas.
Note: don’t update the yaml
schemas with your own custom additions (but if the official versions have updated, then
it’s fine to update them here). If you’d like to add your schema for testing, then please add them as a new schema, and
add them to ./expected/*.ts
.
If you’ve added a feature or fixed a bug and need to update the generated schemas, run the following:
# 1. re-build the package
npm run build
# 2. run the local CLI (not the npm one!)
./bin/cli.js tests/v3/specs/github.yaml -o tests/v3/expected/github.ts
# NOTE: on Windows, try running the script on WSL if getting errors
This should update the expected TypeScript definiton.
Also if this appears in examples/
feel free to update that, too!
npm test
Please check out the the open issues. Issues labelled Help Wanted and Good First Issue are especially good to help with.
Also, please watch the repo and respond to questions/bug reports/feature requests! Thanks!