-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
166 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
# Contributing | ||
|
||
First things first: thank you for contributing! This project will be succesful thanks to everyone who contributes, and we're happy to have you. | ||
|
||
## Bug or issue? | ||
|
||
To raise a bug or issue please use [our GitHub](https://github.com/phalt/clientele/issues). | ||
|
||
Please check the issue has not be raised before by using the search feature. | ||
|
||
When submitting an issue or bug, please make sure you provide thorough detail on: | ||
|
||
1. The version of clientele you are using | ||
2. Any errors or outputs you see in your terminal | ||
3. The OpenAPI schema you are using (this is particularly important). | ||
|
||
## Contribution | ||
|
||
If you want to directly contribute you can do so in two ways: | ||
|
||
1. Documentation | ||
2. Code | ||
|
||
### Documentation | ||
|
||
We use [mkdocs](https://www.mkdocs.org/) and [GitHub pages](https://pages.github.com/) to deploy our docs. | ||
|
||
Fixing grammar, spelling mistakes, or expanding the documentation to cover features that are not yet documented, are all valuable contributions. | ||
|
||
Please see the **Set up** instructions below to run the docs locally on your computer. | ||
|
||
### Code | ||
|
||
Contribution by writing code for new features, or fixing bugs, is a great way to contribute to the project. | ||
|
||
#### Set up | ||
|
||
Clone the repo: | ||
|
||
```sh | ||
git@github.com:phalt/clientele.git | ||
cd clientele | ||
``` | ||
|
||
Move to a feature branch: | ||
|
||
```sh | ||
git branch -B my-branch-name | ||
``` | ||
|
||
Install all the dependencies: | ||
|
||
```sh | ||
python3.11 -m venv .venv | ||
source .venv/bin/activate | ||
make install | ||
``` | ||
|
||
To make sure you have things set up correctly, please run the tests: | ||
|
||
```sh | ||
make test | ||
``` | ||
|
||
### Preparing changes for review | ||
|
||
Once you have made changes, here is a good check list to run through to get it published for review: | ||
|
||
Regenerate the test clients to see what has changed, and if tests pass: | ||
|
||
```sh | ||
make generate-test-clients | ||
make test | ||
``` | ||
|
||
Check your `git diff` to see if anything drastic has changed. If changes happen that you did not expect, something has gone wrong. We want to make sure the clients do not change drastically when adding new features unless it is intended. | ||
|
||
Format and lint the code: | ||
|
||
```sh | ||
make lint | ||
``` | ||
|
||
Make sure you add to `CHANGELOG.md` and `docs/CHANGELOG.md` what changes you have made. | ||
|
||
Make sure you add your name to `CONTRIBUTORS.md` as well! | ||
|
||
### Making a pull request | ||
|
||
Please push your changes up to a feature branch and make a new [pull request](https://github.com/phalt/clientele/compare) on GitHub. | ||
|
||
Please add a description to the PR and some information about why the change is being made. | ||
|
||
After a review you might need to make more changes. | ||
|
||
Once accepted, a core contributor will merge your changes! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,77 @@ | ||
|
||
# 📝 Commands | ||
# 📝 Use Clientele | ||
|
||
## Validate | ||
|
||
Validate lets you check if an OpenAPI schema will work with clientele. Some OpenAPI schema generators do not comply properly with the specification and it is a good way to check if your schema is correct. | ||
|
||
```sh | ||
clientele validate -u http://path.com/to/openapi.json | ||
``` | ||
!!! note | ||
|
||
Alternatively you can provide a local file: | ||
You can type `clientele COMMAND --help` at anytime to see explicit information about the available arguments. | ||
|
||
```sh | ||
clientele validate -f /path/to/openapi.json | ||
``` | ||
## `generate` | ||
|
||
## Generate | ||
Generate a Python HTTP Client from an OpenAPI Schema. | ||
|
||
### From a URL | ||
|
||
Assuming the OpenAPI schema is available on the internet somewhere, you can query it to generate your client. | ||
Use the `-u` or `--url` argument. | ||
|
||
`-o` or `--output` is the target directory for the generate client. | ||
|
||
```sh | ||
clientele generate -u https://raw.githubusercontent.com/phalt/clientele/main/example_openapi_specs/best.json -o my_client/ | ||
``` | ||
|
||
!!! note | ||
|
||
The example above uses a test OpenAPI format, and will work if you copy/paste it! | ||
The example above uses one of our test schemas, and will work if you copy/paste it! | ||
|
||
### From a file | ||
|
||
Alternatively, if you have a local file you can use it to generate your client. | ||
Alternatively you can provide a local file using the `-f` or `--file` argument. | ||
|
||
```sh | ||
clientele generate -f path/to/file.json -o my_client/ | ||
``` | ||
|
||
### Async Client | ||
### Async.io | ||
|
||
If you prefer an [asyncio](https://docs.python.org/3/library/asyncio.html) client, just pass `--asyncio t` to your command. | ||
|
||
```sh | ||
clientele generate -f path/to/file.json -o my_client/ --asyncio t | ||
``` | ||
|
||
## `validate` | ||
|
||
Validate lets you check if an OpenAPI schema will work with clientele. | ||
|
||
!!! note | ||
|
||
You can use this command later to swap between a sync and async client so long as the OpenAPI schema remains the same, so don't worry about making a hard decision now. | ||
Some OpenAPI schema generators do not conform to the [specification](https://spec.openapis.org/oas/v3.1.0). | ||
|
||
Clientele uses [openapi-core](https://openapi-core.readthedocs.io/en/latest/) to validate the schema. | ||
|
||
### From a URL | ||
|
||
Use the `-u` or `--url` argument. | ||
|
||
`-o` or `--output` is the target directory for the generate client. | ||
|
||
```sh | ||
clientele validate -u http://path.com/to/openapi.json | ||
``` | ||
|
||
### From a file path | ||
|
||
Alternatively you can provide a local file using the `-f` or `--file` argument. | ||
|
||
```sh | ||
clientele validate -f /path/to/openapi.json | ||
``` | ||
|
||
## `version` | ||
|
||
Print the current version of Clientele: | ||
|
||
```sh | ||
> clientele version | ||
Clientele 0.7.0 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters