-
Notifications
You must be signed in to change notification settings - Fork 146
docs: add multipart/form-data matching rule example #1350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds documentation and examples for using Pact matching rules with multipart/form-data payloads. The examples demonstrate both consumer and provider tests for validating multipart requests containing JSON metadata and binary image data.
Key changes:
- Created a new patterns catalog structure with a multipart form-data example
- Added comprehensive documentation showing how to apply matching rules to individual parts within multipart bodies
- Included working test implementations for both consumer and provider sides
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| mkdocs.yml | Added Pydantic documentation inventory for cross-referencing |
| examples/catalog/pyproject.toml | New project configuration for the catalog examples with required dependencies |
| examples/catalog/multipart_matching_rules/test_provider.py | Provider verification test demonstrating FastAPI server handling multipart uploads |
| examples/catalog/multipart_matching_rules/test_consumer.py | Consumer test showing how to define matching rules for multipart request parts |
| examples/catalog/multipart_matching_rules/init.py | Empty init file for Python package |
| examples/catalog/multipart_matching_rules/README.md | Documentation explaining the multipart matching rules pattern |
| examples/catalog/init.py | Empty init file for catalog package |
| examples/catalog/README.md | Main catalog documentation with usage instructions |
| examples/README.md | Updated to reference the new patterns catalog |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1350 +/- ##
====================================
Coverage 51% 51%
====================================
Files 31 31
Lines 3727 3727
====================================
Hits 1936 1936
Misses 1791 1791
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
92e8891 to
dd43092
Compare
Add an example which showcases how matching rules can be used to validate multipart/form-data payloads. Signed-off-by: JP-Ellis <josh@jpellis.me>
dd43092 to
c494ce3
Compare
📝 Summary
Add an example which showcases how matching rules can be used to validate multipart/form-data payloads.
🚨 Breaking Changes🔥 Motivation
The
multipart/form-datapayloads will typically contain additional structure internally. In order to validate this in Pact, this requires setting up matching rules, but in a situation where the typical 'embed the matcher with the value' doesn't work; instead requiring that thewith_matching_rulesmethod be called.This documentation hopefully will help end-users validate these kinds of payloads.
🔨 Test Plan
Documentation is through an example, which is run as part of CI.
🔗 Related issues/PRs