Public API reference
Checks
- schemathesis.check(check: CheckFunction) CheckFunction
Register a new check for schemathesis CLI.
- Parameters
check – A function to validate API responses.
@schemathesis.check def new_check(response, case): # some awesome assertions! ...
Fixups
Available fixups:
fast_api
utf8_bom
Authentication
Support for custom API authentication mechanisms.
- schemathesis.auth(provider_class: Optional[Type[AuthProvider]] = None, *, refresh_interval: Optional[int] = 300) Union[FilterableRegisterAuth, FilterableApplyAuth]
Store and manage API authentication.
- class schemathesis.auths.AuthProvider(*args, **kwds)[source]
Get authentication data for an API and set it on the generated test cases.
- get(context: AuthContext) Optional[Auth] [source]
Get the authentication data.
- Parameters
context (AuthContext) – Holds state relevant for the authentication process.
- Returns
Any authentication data you find useful for your use case. For example, it could be an access token.
- set(case: Case, data: Auth, context: AuthContext) None [source]
Set authentication data on a generated test case.
- Parameters
data (Optional[Auth]) – Authentication data you got from the
get
method.case (Case) – Generated test case.
context (AuthContext) – Holds state relevant for the authentication process.
- class schemathesis.auths.AuthContext(operation: APIOperation, app: Optional[Any])[source]
Holds state relevant for the authentication process.
- Variables
operation (APIOperation) – API operation that is currently being processed.
app – Optional Python application if the WSGI / ASGI integration is used.
Hooks
- class schemathesis.hooks.HookContext(operation: Optional[APIOperation] = None)[source]
A context that is passed to some hook functions.
- Variables
operation (Optional[APIOperation]) – API operation that is currently being processed. Might be absent in some cases.
These functions affect Schemathesis behavior globally:
- schemathesis.hook(hook: Union[str, Callable]) Callable
Register a new hook.
- Parameters
hook – Either a hook function or a string.
Can be used as a decorator in two forms. Without arguments for registering hooks and autodetecting their names:
@schemathesis.hook def before_generate_query(context, strategy): ...
With a hook name as the first argument:
@schemathesis.hook("before_generate_query") def hook(context, strategy): ...
- schemathesis.hooks.unregister(hook: Callable) None
Unregister a specific hook.
- Parameters
hook – A hook function to unregister.
- schemathesis.hooks.unregister_all() None
Remove all registered hooks.
Useful in tests.
- class schemathesis.schemas.BaseSchema
All functions above can be accessed via
schema.hooks.<function-name>
on a schema instance. Such calls will affect only tests generated from the schema instance. Additionally you can use the following:- schema.hooks.apply()
Register hook to run only on one test function.
- Parameters
hook – A hook function.
name (Optional[str]) – A hook name.
def before_generate_query(context, strategy): ... @schema.hooks.apply(before_generate_query) @schema.parametrize() def test_api(case): ...
Serializers
- class schemathesis.serializers.SerializerContext(case: Case)[source]
The context for serialization process.
- Variables
case (Case) – Generated example that is being processed.
- schemathesis.serializer(media_type: str, *, aliases: Collection[str] = ()) Callable[[Type[Serializer]], Type[Serializer]]
Register a serializer for the given media type.
Schemathesis uses
requests
for regular network calls andwerkzeug
for WSGI applications. Your serializer should have two methods,as_requests
andas_werkzeug
, providing keyword arguments that Schemathesis will pass torequests.request
andwerkzeug.Client.open
respectively.@register("text/csv") class CSVSerializer: def as_requests(self, context, value): return {"data": to_csv(value)} def as_werkzeug(self, context, value): return {"data": to_csv(value)}
The primary purpose of serializers is to transform data from its Python representation to the format suitable for making an API call. The generated data structure depends on your schema, but its type matches Python equivalents to the JSON Schema types.
Targeted testing
- class schemathesis.targets.TargetContext(case: Case, response: Union[Response, WSGIResponse], response_time: float)[source]
Context for targeted testing.
- Variables
case (Case) – Generated example that is being processed.
response (GenericResponse) – API response.
response_time (float) – API response time.
- schemathesis.target(target: Callable[[TargetContext], float]) Callable[[TargetContext], float]
Register a new testing target for schemathesis CLI.
- Parameters
target – A function that will be called to calculate a metric passed to
hypothesis.target
.
Custom strategies for Open API “format” keyword
- schemathesis.openapi.format(name: str, strategy: SearchStrategy) None
Register a new strategy for generating data for specific string “format”.
- Parameters
name (str) – Format name. It should correspond the one used in the API schema as the “format” keyword value.
strategy – Hypothesis strategy you’d like to use to generate values for this format.
Custom scalars for GraphQL
- schemathesis.graphql.scalar(name: str, strategy: SearchStrategy[ValueNode]) None [source]
Register a new strategy for generating custom scalars.
- Parameters
name (str) – Scalar name. It should correspond the one used in the schema.
strategy – Hypothesis strategy you’d like to use to generate values for this scalar.
Loaders
- schemathesis.from_aiohttp(schema_path: str, app: ~typing.Any, *, base_url: ~typing.Optional[str] = None, method: ~typing.Optional[~typing.Union[str, ~typing.List[str], ~typing.Tuple[str], ~typing.Set[str], ~schemathesis.types.NotSet]] = None, endpoint: ~typing.Optional[~typing.Union[str, ~typing.List[str], ~typing.Tuple[str], ~typing.Set[str], ~schemathesis.types.NotSet]] = None, tag: ~typing.Optional[~typing.Union[str, ~typing.List[str], ~typing.Tuple[str], ~typing.Set[str], ~schemathesis.types.NotSet]] = None, operation_id: ~typing.Optional[~typing.Union[str, ~typing.List[str], ~typing.Tuple[str], ~typing.Set[str], ~schemathesis.types.NotSet]] = None, skip_deprecated_operations: bool = False, validate_schema: bool = False, force_schema_version: ~typing.Optional[str] = None, data_generation_methods: ~typing.Union[DataGenerationMethod, ~typing.Iterable[DataGenerationMethod]] = (<DataGenerationMethod.positive: 'positive'>,), code_sample_style: str = 'curl', rate_limit: ~typing.Optional[str] = None, **kwargs: ~typing.Any) BaseOpenAPISchema [source]
Load Open API schema from an AioHTTP app.
- Parameters
schema_path (str) – An in-app relative URL to the schema.
app – An AioHTTP app instance.
- schemathesis.from_asgi(schema_path: str, app: ~typing.Any, *, base_url: ~typing.Optional[str] = None, method: ~typing.Optional[~typing.Union[str, ~typing.List[str], ~typing.Tuple[str], ~typing.Set[str], ~schemathesis.types.NotSet]] = None, endpoint: ~typing.Optional[~typing.Union[str, ~typing.List[str], ~typing.Tuple[str], ~typing.Set[str], ~schemathesis.types.NotSet]] = None, tag: ~typing.Optional[~typing.Union[str, ~typing.List[str], ~typing.Tuple[str], ~typing.Set[str], ~schemathesis.types.NotSet]] = None, operation_id: ~typing.Optional[~typing.Union[str, ~typing.List[str], ~typing.Tuple[str], ~typing.Set[str], ~schemathesis.types.NotSet]] = None, skip_deprecated_operations: bool = False, validate_schema: bool = False, force_schema_version: ~typing.Optional[str] = None, data_generation_methods: ~typing.Union[DataGenerationMethod, ~typing.Iterable[DataGenerationMethod]] = (<DataGenerationMethod.positive: 'positive'>,), code_sample_style: str = 'curl', rate_limit: ~typing.Optional[str] = None, **kwargs: ~typing.Any) BaseOpenAPISchema [source]
Load Open API schema from an ASGI app.
- Parameters
schema_path (str) – An in-app relative URL to the schema.
app – An ASGI app instance.
- schemathesis.from_dict(raw_schema: ~typing.Dict[str, ~typing.Any], *, app: ~typing.Any = None, base_url: ~typing.Optional[str] = None, method: ~typing.Optional[~typing.Union[str, ~typing.List[str], ~typing.Tuple[str], ~typing.Set[str], ~schemathesis.types.NotSet]] = None, endpoint: ~typing.Optional[~typing.Union[str, ~typing.List[str], ~typing.Tuple[str], ~typing.Set[str], ~schemathesis.types.NotSet]] = None, tag: ~typing.Optional[~typing.Union[str, ~typing.List[str], ~typing.Tuple[str], ~typing.Set[str], ~schemathesis.types.NotSet]] = None, operation_id: ~typing.Optional[~typing.Union[str, ~typing.List[str], ~typing.Tuple[str], ~typing.Set[str], ~schemathesis.types.NotSet]] = None, skip_deprecated_operations: bool = False, validate_schema: bool = False, force_schema_version: ~typing.Optional[str] = None, data_generation_methods: ~typing.Union[DataGenerationMethod, ~typing.Iterable[DataGenerationMethod]] = (<DataGenerationMethod.positive: 'positive'>,), code_sample_style: str = 'curl', location: ~typing.Optional[str] = None, rate_limit: ~typing.Optional[str] = None) BaseOpenAPISchema [source]
Load Open API schema from a Python dictionary.
- Parameters
raw_schema (dict) – A schema to load.
- schemathesis.from_file(file: ~typing.Union[~typing.IO[str], str], *, app: ~typing.Any = None, base_url: ~typing.Optional[str] = None, method: ~typing.Optional[~typing.Union[str, ~typing.List[str], ~typing.Tuple[str], ~typing.Set[str], ~schemathesis.types.NotSet]] = None, endpoint: ~typing.Optional[~typing.Union[str, ~typing.List[str], ~typing.Tuple[str], ~typing.Set[str], ~schemathesis.types.NotSet]] = None, tag: ~typing.Optional[~typing.Union[str, ~typing.List[str], ~typing.Tuple[str], ~typing.Set[str], ~schemathesis.types.NotSet]] = None, operation_id: ~typing.Optional[~typing.Union[str, ~typing.List[str], ~typing.Tuple[str], ~typing.Set[str], ~schemathesis.types.NotSet]] = None, skip_deprecated_operations: bool = False, validate_schema: bool = False, force_schema_version: ~typing.Optional[str] = None, data_generation_methods: ~typing.Union[DataGenerationMethod, ~typing.Iterable[DataGenerationMethod]] = (<DataGenerationMethod.positive: 'positive'>,), code_sample_style: str = 'curl', location: ~typing.Optional[str] = None, rate_limit: ~typing.Optional[str] = None, __expects_json: bool = False, **kwargs: ~typing.Any) BaseOpenAPISchema [source]
Load Open API schema from a file descriptor, string or bytes.
- Parameters
file – Could be a file descriptor, string or bytes.
- schemathesis.from_path(path: ~typing.Union[~pathlib.Path, str], *, app: ~typing.Any = None, base_url: ~typing.Optional[str] = None, method: ~typing.Optional[~typing.Union[str, ~typing.List[str], ~typing.Tuple[str], ~typing.Set[str], ~schemathesis.types.NotSet]] = None, endpoint: ~typing.Optional[~typing.Union[str, ~typing.List[str], ~typing.Tuple[str], ~typing.Set[str], ~schemathesis.types.NotSet]] = None, tag: ~typing.Optional[~typing.Union[str, ~typing.List[str], ~typing.Tuple[str], ~typing.Set[str], ~schemathesis.types.NotSet]] = None, operation_id: ~typing.Optional[~typing.Union[str, ~typing.List[str], ~typing.Tuple[str], ~typing.Set[str], ~schemathesis.types.NotSet]] = None, skip_deprecated_operations: bool = False, validate_schema: bool = False, force_schema_version: ~typing.Optional[str] = None, data_generation_methods: ~typing.Union[DataGenerationMethod, ~typing.Iterable[DataGenerationMethod]] = (<DataGenerationMethod.positive: 'positive'>,), code_sample_style: str = 'curl', rate_limit: ~typing.Optional[str] = None, encoding: str = 'utf8') BaseOpenAPISchema [source]
Load Open API schema via a file from an OS path.
- Parameters
path – A path to the schema file.
encoding – The name of the encoding used to decode the file.
- schemathesis.from_pytest_fixture(fixture_name: str, *, app: ~typing.Any = <schemathesis.types.NotSet object>, base_url: ~typing.Union[str, None, ~schemathesis.types.NotSet] = <schemathesis.types.NotSet object>, method: ~typing.Optional[~typing.Union[str, ~typing.List[str], ~typing.Tuple[str], ~typing.Set[str], ~schemathesis.types.NotSet]] = <schemathesis.types.NotSet object>, endpoint: ~typing.Optional[~typing.Union[str, ~typing.List[str], ~typing.Tuple[str], ~typing.Set[str], ~schemathesis.types.NotSet]] = <schemathesis.types.NotSet object>, tag: ~typing.Optional[~typing.Union[str, ~typing.List[str], ~typing.Tuple[str], ~typing.Set[str], ~schemathesis.types.NotSet]] = <schemathesis.types.NotSet object>, operation_id: ~typing.Optional[~typing.Union[str, ~typing.List[str], ~typing.Tuple[str], ~typing.Set[str], ~schemathesis.types.NotSet]] = <schemathesis.types.NotSet object>, skip_deprecated_operations: bool = False, validate_schema: bool = False, data_generation_methods: ~typing.Union[DataGenerationMethod, ~typing.Iterable[DataGenerationMethod], ~schemathesis.types.NotSet] = <schemathesis.types.NotSet object>, code_sample_style: str = 'curl', rate_limit: ~typing.Optional[str] = None) LazySchema [source]
Load schema from a
pytest
fixture.It is useful if you don’t want to make network requests during module loading. With this loader you can defer it to a fixture.
Note, the fixture should return a
BaseSchema
instance loaded with another loader.- Parameters
fixture_name (str) – The name of a fixture to load.
- schemathesis.from_uri(uri: str, *, app: ~typing.Any = None, base_url: ~typing.Optional[str] = None, port: ~typing.Optional[int] = None, method: ~typing.Optional[~typing.Union[str, ~typing.List[str], ~typing.Tuple[str], ~typing.Set[str], ~schemathesis.types.NotSet]] = None, endpoint: ~typing.Optional[~typing.Union[str, ~typing.List[str], ~typing.Tuple[str], ~typing.Set[str], ~schemathesis.types.NotSet]] = None, tag: ~typing.Optional[~typing.Union[str, ~typing.List[str], ~typing.Tuple[str], ~typing.Set[str], ~schemathesis.types.NotSet]] = None, operation_id: ~typing.Optional[~typing.Union[str, ~typing.List[str], ~typing.Tuple[str], ~typing.Set[str], ~schemathesis.types.NotSet]] = None, skip_deprecated_operations: bool = False, validate_schema: bool = False, force_schema_version: ~typing.Optional[str] = None, data_generation_methods: ~typing.Union[DataGenerationMethod, ~typing.Iterable[DataGenerationMethod]] = (<DataGenerationMethod.positive: 'positive'>,), code_sample_style: str = 'curl', wait_for_schema: ~typing.Optional[float] = None, rate_limit: ~typing.Optional[str] = None, **kwargs: ~typing.Any) BaseOpenAPISchema [source]
Load Open API schema from the network.
- Parameters
uri (str) – Schema URL.
- schemathesis.from_wsgi(schema_path: str, app: ~typing.Any, *, base_url: ~typing.Optional[str] = None, method: ~typing.Optional[~typing.Union[str, ~typing.List[str], ~typing.Tuple[str], ~typing.Set[str], ~schemathesis.types.NotSet]] = None, endpoint: ~typing.Optional[~typing.Union[str, ~typing.List[str], ~typing.Tuple[str], ~typing.Set[str], ~schemathesis.types.NotSet]] = None, tag: ~typing.Optional[~typing.Union[str, ~typing.List[str], ~typing.Tuple[str], ~typing.Set[str], ~schemathesis.types.NotSet]] = None, operation_id: ~typing.Optional[~typing.Union[str, ~typing.List[str], ~typing.Tuple[str], ~typing.Set[str], ~schemathesis.types.NotSet]] = None, skip_deprecated_operations: bool = False, validate_schema: bool = False, force_schema_version: ~typing.Optional[str] = None, data_generation_methods: ~typing.Union[DataGenerationMethod, ~typing.Iterable[DataGenerationMethod]] = (<DataGenerationMethod.positive: 'positive'>,), code_sample_style: str = 'curl', rate_limit: ~typing.Optional[str] = None, **kwargs: ~typing.Any) BaseOpenAPISchema [source]
Load Open API schema from a WSGI app.
- Parameters
schema_path (str) – An in-app relative URL to the schema.
app – A WSGI app instance.
- schemathesis.graphql.from_dict(raw_schema: ~typing.Dict[str, ~typing.Any], *, app: ~typing.Any = None, base_url: ~typing.Optional[str] = None, location: ~typing.Optional[str] = None, data_generation_methods: ~typing.Union[DataGenerationMethod, ~typing.Iterable[DataGenerationMethod]] = (<DataGenerationMethod.positive: 'positive'>,), code_sample_style: str = 'curl', rate_limit: ~typing.Optional[str] = None) GraphQLSchema [source]
Load GraphQL schema from a Python dictionary.
- Parameters
raw_schema (dict) – A schema to load.
location (Optional[str]) – Optional schema location. Either a full URL or a filesystem path.
base_url (Optional[str]) – Base URL to send requests to.
app – A WSGI app instance.
- Returns
GraphQLSchema
- schemathesis.graphql.from_url(url: str, *, app: ~typing.Any = None, base_url: ~typing.Optional[str] = None, port: ~typing.Optional[int] = None, data_generation_methods: ~typing.Union[DataGenerationMethod, ~typing.Iterable[DataGenerationMethod]] = (<DataGenerationMethod.positive: 'positive'>, ), code_sample_style: str = 'curl', wait_for_schema: ~typing.Optional[float] = None, rate_limit: ~typing.Optional[str] = None, **kwargs: ~typing.Any) GraphQLSchema [source]
Load GraphQL schema from the network.
- Parameters
url – Schema URL.
base_url (Optional[str]) – Base URL to send requests to.
port (Optional[int]) – An optional port if you don’t want to pass the
base_url
parameter, but only to change port inurl
.app – A WSGI app instance.
- Returns
GraphQLSchema
- schemathesis.graphql.from_wsgi(schema_path: str, app: ~typing.Any, *, base_url: ~typing.Optional[str] = None, data_generation_methods: ~typing.Union[DataGenerationMethod, ~typing.Iterable[DataGenerationMethod]] = (<DataGenerationMethod.positive: 'positive'>, ), code_sample_style: str = 'curl', rate_limit: ~typing.Optional[str] = None, **kwargs: ~typing.Any) GraphQLSchema [source]
Load GraphQL schema from a WSGI app.
- Parameters
schema_path (str) – An in-app relative URL to the schema.
app – A WSGI app instance.
base_url (Optional[str]) – Base URL to send requests to.
- Returns
GraphQLSchema
Schema
- class schemathesis.schemas.BaseSchema[source]
BaseSchema(raw_schema: Dict[str, Any], location: Union[str, NoneType] = None, base_url: Union[str, NoneType] = None, method: Union[str, List[str], Tuple[str], Set[str], schemathesis.types.NotSet, NoneType] = None, endpoint: Union[str, List[str], Tuple[str], Set[str], schemathesis.types.NotSet, NoneType] = None, tag: Union[str, List[str], Tuple[str], Set[str], schemathesis.types.NotSet, NoneType] = None, operation_id: Union[str, List[str], Tuple[str], Set[str], schemathesis.types.NotSet, NoneType] = None, app: Any = None, hooks: schemathesis.hooks.HookDispatcher = <factory>, auth: schemathesis.auths.AuthStorage = <factory>, test_function: Union[Callable[…, NoneType], NoneType] = None, validate_schema: bool = True, skip_deprecated_operations: bool = False, data_generation_methods: List[schemathesis.constants.DataGenerationMethod] = <factory>, code_sample_style: schemathesis.constants.CodeSampleStyle = <CodeSampleStyle.curl: ‘curl’>, rate_limiter: Union[pyrate_limiter.limiter.Limiter, NoneType] = None)
- parametrize(method: ~typing.Optional[~typing.Union[str, ~typing.List[str], ~typing.Tuple[str], ~typing.Set[str], ~schemathesis.types.NotSet]] = <schemathesis.types.NotSet object>, endpoint: ~typing.Optional[~typing.Union[str, ~typing.List[str], ~typing.Tuple[str], ~typing.Set[str], ~schemathesis.types.NotSet]] = <schemathesis.types.NotSet object>, tag: ~typing.Optional[~typing.Union[str, ~typing.List[str], ~typing.Tuple[str], ~typing.Set[str], ~schemathesis.types.NotSet]] = <schemathesis.types.NotSet object>, operation_id: ~typing.Optional[~typing.Union[str, ~typing.List[str], ~typing.Tuple[str], ~typing.Set[str], ~schemathesis.types.NotSet]] = <schemathesis.types.NotSet object>, validate_schema: ~typing.Union[bool, ~schemathesis.types.NotSet] = <schemathesis.types.NotSet object>, skip_deprecated_operations: ~typing.Union[bool, ~schemathesis.types.NotSet] = <schemathesis.types.NotSet object>, data_generation_methods: ~typing.Union[~typing.Iterable[~schemathesis.constants.DataGenerationMethod], ~schemathesis.types.NotSet] = <schemathesis.types.NotSet object>, code_sample_style: ~typing.Union[str, ~schemathesis.types.NotSet] = <schemathesis.types.NotSet object>) Callable [source]
Mark a test function as a parametrized one.
- given(*args: Union[SearchStrategy, ellipsis], **kwargs: Union[SearchStrategy, ellipsis]) Callable [source]
Proxy Hypothesis strategies to
hypothesis.given
.
- as_state_machine() Type[APIStateMachine] [source]
Create a state machine class.
Use it for stateful testing.
- class schemathesis.models.APIOperation[source]
A single operation defined in an API.
You can get one via a
schema
instance.# Get the POST /items operation operation = schema["/items"]["POST"]
- Members
- validate_response(response: Union[Response, WSGIResponse]) None [source]
Validate API response for conformance.
- Raises
CheckFailed – If the response does not conform to the API schema.
- is_response_valid(response: Union[Response, WSGIResponse]) bool [source]
Validate API response for conformance.
- make_case(*, path_parameters: ~typing.Optional[~typing.Dict[str, ~typing.Any]] = None, headers: ~typing.Optional[~typing.Dict[str, ~typing.Any]] = None, cookies: ~typing.Optional[~typing.Dict[str, ~typing.Any]] = None, query: ~typing.Optional[~typing.Dict[str, ~typing.Any]] = None, body: ~typing.Union[~typing.List, ~typing.Dict[str, ~typing.Any], str, int, float, bool, bytes, ~schemathesis.types.NotSet] = <schemathesis.types.NotSet object>, media_type: ~typing.Optional[str] = None) C [source]
Create a new example for this API operation.
The main use case is constructing Case instances completely manually, without data generation.
Open API-specific API
- class schemathesis.specs.openapi.schemas.BaseOpenAPISchema[source]
BaseOpenAPISchema(raw_schema: Dict[str, Any], location: Union[str, NoneType] = None, base_url: Union[str, NoneType] = None, method: Union[str, List[str], Tuple[str], Set[str], schemathesis.types.NotSet, NoneType] = None, endpoint: Union[str, List[str], Tuple[str], Set[str], schemathesis.types.NotSet, NoneType] = None, tag: Union[str, List[str], Tuple[str], Set[str], schemathesis.types.NotSet, NoneType] = None, operation_id: Union[str, List[str], Tuple[str], Set[str], schemathesis.types.NotSet, NoneType] = None, app: Any = None, hooks: schemathesis.hooks.HookDispatcher = <factory>, auth: schemathesis.auths.AuthStorage = <factory>, test_function: Union[Callable[…, NoneType], NoneType] = None, validate_schema: bool = True, skip_deprecated_operations: bool = False, data_generation_methods: List[schemathesis.constants.DataGenerationMethod] = <factory>, code_sample_style: schemathesis.constants.CodeSampleStyle = <CodeSampleStyle.curl: ‘curl’>, rate_limiter: Union[pyrate_limiter.limiter.Limiter, NoneType] = None, _inline_reference_cache: Dict[str, Any] = <factory>, _inline_reference_cache_lock: <function RLock at 0x7f28205e8200> = <factory>)
- add_link(source: APIOperation, target: Union[str, APIOperation], status_code: Union[str, int], parameters: Optional[Dict[str, str]] = None, request_body: Optional[Any] = None, name: Optional[str] = None) None [source]
Add a new Open API link to the schema definition.
- Parameters
source (APIOperation) – This operation is the source of data
target – This operation will receive the data from this link. Can be an
APIOperation
instance or a reference like this -#/paths/~1users~1{userId}/get
status_code (str) – The link is triggered when the source API operation responds with this status code.
parameters – A dictionary that describes how parameters should be extracted from the matched response. The key represents the parameter name in the target API operation, and the value is a runtime expression string.
request_body – A literal value or runtime expression to use as a request body when calling the target operation.
name (str) – Explicit link name.
schema = schemathesis.from_uri("http://0.0.0.0/schema.yaml") schema.add_link( source=schema["/users/"]["POST"], target=schema["/users/{userId}"]["GET"], status_code="201", parameters={"userId": "$response.body#/id"}, )