Skip to content

Latest commit

 

History

History
82 lines (60 loc) · 3.23 KB

CONTRIBUTING.md

File metadata and controls

82 lines (60 loc) · 3.23 KB

Contributing

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

Project setup

  1. Install pnpm
  2. Fork and clone the repo
  3. Run pnpm i to install dependencies
  4. 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 run git pull. Then you can make all of your pull request branches based on this main branch. Whenever you want to update your version of main, do a regular git pull.

Committing and pushing changes

Please make sure to run the tests (npm test) before you commit your changes.

Local schemas

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.

Regenerating schemas

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!

Testing

npm test

Help needed

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!