Skip to content

Commit b182478

Browse files
committed
docs: update matcher docs
1 parent 96d79e8 commit b182478

File tree

1 file changed

+60
-38
lines changed

1 file changed

+60
-38
lines changed

src/pact/match/matcher.py

Lines changed: 60 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,8 @@ def to_integration_json(self) -> dict[str, Any]:
4747
This method is used internally to convert the matcher to a JSON object
4848
which can be embedded directly in a number of places in the Pact FFI.
4949
50-
For more information about this format, see the docs:
51-
52-
> https://docs.pact.io/implementation_guides/rust/pact_ffi/integrationjson
50+
For more information about this format, see the [integration JSON
51+
docs](https://docs.pact.io/implementation_guides/rust/pact_ffi/integrationjson).
5352
5453
Returns:
5554
The matcher as an integration JSON object.
@@ -63,13 +62,10 @@ def to_matching_rule(self) -> dict[str, Any]:
6362
This method is used internally to convert the matcher to a matching rule
6463
which can be embedded directly in a Pact file.
6564
66-
For more information about this format, see the docs:
67-
68-
> https://github.com/pact-foundation/pact-specification/tree/version-4
69-
70-
and
71-
72-
> https://github.com/pact-foundation/pact-specification/tree/version-2?tab=readme-ov-file#matchers
65+
For more information about this format, refer to the [Pact
66+
specification](https://github.com/pact-foundation/pact-specification/tree/version-4)
67+
and the [matchers
68+
section](https://github.com/pact-foundation/pact-specification/tree/version-2?tab=readme-ov-file#matchers)
7369
7470
Returns:
7571
The matcher as a matching rule.
@@ -151,15 +147,9 @@ def to_integration_json(self) -> dict[str, Any]:
151147
"""
152148
Convert the matcher to an integration JSON object.
153149
154-
This method is used internally to convert the matcher to a JSON object
155-
which can be embedded directly in a number of places in the Pact FFI.
156-
157-
For more information about this format, see the docs:
158-
159-
> https://docs.pact.io/implementation_guides/rust/pact_ffi/integrationjson
160-
161-
Returns:
162-
The matcher as an integration JSON object.
150+
See
151+
[`AbstractMatcher.to_integration_json`][pact.match.matcher.AbstractMatcher.to_integration_json]
152+
for more information.
163153
"""
164154
return {
165155
"pact:matcher:type": self.type,
@@ -176,19 +166,9 @@ def to_matching_rule(self) -> dict[str, Any]:
176166
"""
177167
Convert the matcher to a matching rule.
178168
179-
This method is used internally to convert the matcher to a matching rule
180-
which can be embedded directly in a Pact file.
181-
182-
For more information about this format, see the docs:
183-
184-
> https://github.com/pact-foundation/pact-specification/tree/version-4
185-
186-
and
187-
188-
> https://github.com/pact-foundation/pact-specification/tree/version-2?tab=readme-ov-file#matchers
189-
190-
Returns:
191-
The matcher as a matching rule.
169+
See
170+
[`AbstractMatcher.to_matching_rule`][pact.match.matcher.AbstractMatcher.to_matching_rule]
171+
for more information.
192172
"""
193173
return {
194174
"match": self.type,
@@ -217,10 +197,24 @@ def __init__(self, variants: Sequence[_T_co | AbstractMatcher[_T_co]]) -> None:
217197
extra_fields={"variants": variants},
218198
)
219199

220-
def to_integration_json(self) -> dict[str, Any]: # noqa: D102
200+
def to_integration_json(self) -> dict[str, Any]:
201+
"""
202+
Convert the matcher to an integration JSON object.
203+
204+
See
205+
[`AbstractMatcher.to_integration_json`][pact.match.matcher.AbstractMatcher.to_integration_json]
206+
for more information.
207+
"""
221208
return self._matcher.to_integration_json()
222209

223-
def to_matching_rule(self) -> dict[str, Any]: # noqa: D102
210+
def to_matching_rule(self) -> dict[str, Any]:
211+
"""
212+
Convert the matcher to a matching rule.
213+
214+
See
215+
[`AbstractMatcher.to_matching_rule`][pact.match.matcher.AbstractMatcher.to_matching_rule]
216+
for more information.
217+
"""
224218
return self._matcher.to_matching_rule()
225219

226220

@@ -252,10 +246,24 @@ def __init__(
252246
extra_fields={"rules": rules},
253247
)
254248

255-
def to_integration_json(self) -> dict[str, Any]: # noqa: D102
249+
def to_integration_json(self) -> dict[str, Any]:
250+
"""
251+
Convert the matcher to an integration JSON object.
252+
253+
See
254+
[`AbstractMatcher.to_integration_json`][pact.match.matcher.AbstractMatcher.to_integration_json]
255+
for more information.
256+
"""
256257
return self._matcher.to_integration_json()
257258

258-
def to_matching_rule(self) -> dict[str, Any]: # noqa: D102
259+
def to_matching_rule(self) -> dict[str, Any]:
260+
"""
261+
Convert the matcher to a matching rule.
262+
263+
See
264+
[`AbstractMatcher.to_matching_rule`][pact.match.matcher.AbstractMatcher.to_matching_rule]
265+
for more information.
266+
"""
259267
return self._matcher.to_matching_rule()
260268

261269

@@ -287,10 +295,24 @@ def __init__(
287295
extra_fields={"rules": rules},
288296
)
289297

290-
def to_integration_json(self) -> dict[str, Any]: # noqa: D102
298+
def to_integration_json(self) -> dict[str, Any]:
299+
"""
300+
Convert the matcher to an integration JSON object.
301+
302+
See
303+
[`AbstractMatcher.to_integration_json`][pact.match.matcher.AbstractMatcher.to_integration_json]
304+
for more information.
305+
"""
291306
return self._matcher.to_integration_json()
292307

293-
def to_matching_rule(self) -> dict[str, Any]: # noqa: D102
308+
def to_matching_rule(self) -> dict[str, Any]:
309+
"""
310+
Convert the matcher to a matching rule.
311+
312+
See
313+
[`AbstractMatcher.to_matching_rule`][pact.match.matcher.AbstractMatcher.to_matching_rule]
314+
for more information.
315+
"""
294316
return self._matcher.to_matching_rule()
295317

296318

0 commit comments

Comments
 (0)