- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Test it:
cargo test --features runtime-blocking
- Lint it:
cargo +nightly clippy --all --all-targets -- -D warnings
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
We use rustfmt
to keep our codebase consistently formatted. Please ensure that
you have correctly formatted your code (most editors will do this automatically
when saving) or it may not pass the CI tests.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as in the README, without any additional terms or conditions.
These are requirements we have that we have not yet lifted to the level of automatic enforcement.
In each file the imports should be grouped into at most 4 groups in the following order:
- stdlib
- non-repository local crates
- repository local other crates
- this crate
Separate each group with a blank line, and rustfmt will sort into a canonical order. Any file that is not grouped like this can be rearranged whenever the file is touched - we're not precious about having it done in a separate commit, though that is helpful.
We ask that contributors keep the clippy status clean. Minimally, run cargo clippy
before submitting code. Clippy is also run in GitHub Actions.
It is expected that code is uniformly formatted. Before submitting code, make sure
to run cargo fmt
to make sure it conforms to the standard.
This library is (mostly) authored via code generation by parsing the OpenAPI specification for Stripe.
To automatically update the generated code, copy it into the generated
folder, and format, use the cargo make
target
openapi-install
. This will also fetch the latest spec from the repository.
cargo make openapi-install
To run the tests, you will need
to run a stripe-mock
server and select a runtime. CI runs tests against all runtimes, but it is encouraged you test your changes locally against a few runtimes first.
docker run --rm -d -it -p 12111-12112:12111-12112 stripemock/stripe-mock:latest
cargo test --features runtime-async-std-surf
It is encouraged to open an issue before you create a PR as a place for pre-implementation discussion. If you're unsure about your contribution or simply want to ask a question about anything just open an issue and we'll chat.
This project makes wide use of code generation, with API types generated directly from the stripe openapi spec. This is what the openapi tool does. All generated code ends up in the handily named generated folder which is exposed based on features specified.
In some cases, it is helpful to have additional logic associated with a datatype to, for example,
capture a create Charge
object. This additional impl goes in the charge_ext.rs
file in the
resources
folder, to provide a clean seperation between generated and hand maintained files.
If you notice that logic is missing, please add it to (or create) the appropriate ext
file.