In this update, I've focused on significantly improving configuration flexibility and testing explicit examples from the spec. Key highlights include:
Open API parameter overrides
Introducing an easier and more efficient way to override Open API parameters directly in CLI or Python tests:
shell
$ st run --set-query apiKey=secret --set-path user_id=42 ...
and
python
schema.parametrize()
schema.override(path_parameters={"user_id": "42"}, query={"apiKey": "secret"})
def test_api(case):
...
This way, parameter overrides will only be applied to API operations that use the overridden parameters and won't take time during data generation.
Reworked schema examples testing
A nearly full rewrite of how Schemathesis handles explicit example testing. It fixes a couple of bugs and allows for testing all `examples` keywords, including ones inside individual properties, or different media types.
:rocket: Added
- CLI options for overriding Open API parameters in test cases. 1676
- A way to override Open API parameters in the `pytest` integration with the `override` decorator. 8
- **Open API**: Support for the `examples` keyword inside individual property schemas. 1730, 1320
- **Open API**: Extract explicit examples from all defined media types. 921
:wrench: Changed
- Raise an error if it is not possible to generate explicit examples. 1771
- Avoid using the deprecated `cgi` module. 1962
:bug: Fixed
- **Open API**: Properly combine multiple explicit examples extracted from `examples` and `example` fields. 1360
- **Open API**: Ignoring examples referenced via the `$ref` keyword. 1692