Skip to content

Commit a719c87

Browse files
authored
Update CONTRIBUTING.md
1 parent 6b68dae commit a719c87

File tree

1 file changed

+42
-10
lines changed

1 file changed

+42
-10
lines changed

CONTRIBUTING.md

+42-10
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,59 @@
11
# Ways you can Contribute
22

3-
- Document bugs and missing features as issues.
4-
- Find and document the relevant [OpenAPI specification](https://swagger.io/specification/) for open issues.
5-
- Create a pull request addressing an open issue.
3+
- Report bugs via [issues](https://github.com/openapi-generators/openapi-python-client/issues)
4+
- Request features via [discussions](https://github.com/openapi-generators/openapi-python-client/discussions)
5+
- Contribute code via [pull request](https://github.com/openapi-generators/openapi-python-client/pulls)
66

7-
# Contributing Code
7+
## Reporting a bug
88

9-
## Setting up a Dev Environment
9+
A bug is one of:
10+
11+
1. You get an exception when running the generator
12+
2. The generated code is invalid or incorrect
13+
3. An error message is unclear or incorrect
14+
4. Something which used to work no longer works, except:
15+
1. Intentional breaking changes, which are documented in the [changelog](https://github.com/openapi-generators/openapi-python-client/blob/main/CHANGELOG.md)
16+
2. Breaking changes to unstable features, like custom templates
17+
18+
If your issue does not fall under one of the above, it is not a bug; check out "[Requesting a feature](#requesting-a-feature).
19+
20+
### Report requirements
21+
22+
A bug report **must** have an OpenAPI document that can be used to replicate the bug. Reports without a valid document will be closed.
23+
24+
## Requesting a feature
25+
26+
A feature is usually:
27+
28+
1. An improvement to the way the generated code works
29+
2. A feature of the generator itself which makes its use easier (e.g., a new config option)
30+
3. **Support for part of the OpenAPI spec**; this generate _does not yet_ support every OpenAPI feature, these missing features **are not bugs**.
31+
32+
To request a feature:
33+
34+
1. Search through [discussions](https://github.com/openapi-generators/openapi-python-client/discussions/categories/feature-request) to see if the feature you want has already been requested. If it has:
35+
1. Upvote it with the little arrow on the original post. This enables code contributors to prioritize the most-demanded features.
36+
2. Optionally leave a comment describing why _you_ want the feature, if no existing thread already covers your use-case
37+
3. If a relevant discussion does not already exist, create a new one. If you are not requesting support for part of the OpenAPI spec, **you must** describe _why_ you want the feature. What real-world use-case does it improve? For example, "raise exceptions for invalid responses" might have a description of "it's not worth the effort to check every error case by hand for the one-off scripts I'm writing".
38+
39+
## Contributing Code
40+
41+
### Setting up a Dev Environment
1042

1143
1. Make sure you have [Poetry](https://python-poetry.org/) installed and up to date.
1244
2. Make sure you have a supported Python version (e.g. 3.8) installed and accessible to Poetry (e.g. with [pyenv](https://github.com/pyenv/pyenv)).
1345
3. Use `poetry install` in the project directory to create a virtual environment with the relevant dependencies.
1446
4. Enter a `poetry shell` to make running commands easier.
1547

16-
## Writing Code
48+
### Writing Code
1749

1850
1. Write some code and make sure it's covered by unit tests. All unit tests are in the `tests` directory and the file structure should mirror the structure of the source code in the `openapi_python_client` directory.
1951

20-
### Run Checks and Tests
52+
#### Run Checks and Tests
2153

2254
2. When in a Poetry shell (`poetry shell`) run `task check` in order to run most of the same checks CI runs. This will auto-reformat the code, check type annotations, run unit tests, check code coverage, and lint the code.
2355

24-
### Rework end-to-end tests
56+
#### Rework end-to-end tests
2557

2658
3. If you're writing a new feature, try to add it to the end-to-end test.
2759
1. If adding support for a new OpenAPI feature, add it somewhere in `end_to_end_tests/openapi.json`
@@ -30,7 +62,7 @@
3062
4. **If you added a test above OR modified the templates**: Run the end-to-end tests with `task e2e`. This will generate clients against `end_to_end_tests/openapi.json` and compare them with the golden record. The tests will fail if **anything is different**. The end-to-end tests are not included in `task check` as they take longer to run and don't provide very useful feedback in the event of failure. If an e2e test does fail, the easiest way to check what's wrong is to run `task regen` and check the diffs. You can also use `task re` which will run `regen` and `e2e` in that order.
3163

3264

33-
## Creating a Pull Request
65+
### Creating a Pull Request
3466

3567
Once you've written the code and run the checks, the next step is to create a pull request against the `main` branch of this repository. This repository uses [conventional commits] squashed on each PR, then uses [Knope] to auto-generate CHANGELOG.md entries for release. So the title of your PR should be in the format of a conventional commit written in plain english as it will end up in the CHANGELOG. Some example PR titles:
3668

@@ -40,7 +72,7 @@ Once you've written the code and run the checks, the next step is to create a pu
4072

4173
Once your PR is created, a series of automated checks should run. If any of them fail, try your best to fix them.
4274

43-
## Wait for Review
75+
### Wait for Review
4476

4577
As soon as possible, your PR will be reviewed. If there are any changes requested there will likely be a bit of back and forth. Once this process is done, your changes will be merged into main and included in the next release. If you need your changes available on PyPI by a certain time, please mention it in the PR, and we'll do our best to accommodate.
4678

0 commit comments

Comments
 (0)