Pact V3 Tracking Issue
YOU54F opened this issue · 0 comments
YOU54F commented
We would like to implement Pact V3 Specification support for Pact Ruby
Current status
- Initial 3.0.0 support for asynchronous message pact via pact-message-ruby
- Initial support for providerStates
⚠️ Currently only supports the first providerStates array entry⚠️ Currently does not support providerStates params
Required V3 Features
- Generators
- Partially implemented in #273
- Matchers
- Combined matchers initial work started here
- Provider States
- Support providerStates array and params.
- HTTP V3 support
- Block any unsupported features for versions less than V3
Implementation notes
- Strong consideration should be made for incorporating pact_ffi functionality (see #317) rather than re-implementing in ruby
Validation
- The pact-compatibility-suite should be considered for cross language validation
- Tests should be added to showcase new features
V3 Related Issues
Will be tagging and closing related v3/v4 issues, and linking to this meta issue
- #266
- pact-foundation/pact-support#67
- pact-foundation/pact-ruby-standalone#34
- pact-foundation/pact-support#61
- pact-foundation/pact-support#65
- pact-foundation/pact-provider-verifier#61
- pact-foundation/pact-ruby-standalone#143
- #107
- #157
- pact-foundation/pact-provider-verifier#19
- pact-foundation/pact-message-ruby#6
- pact-foundation/pact-message-ruby#5
- pact-foundation/pact-message-ruby#4
- pact-foundation/pact-message-ruby#2
- #192
- #168
- #318
V3 Generators
Generator | Attributes | Description | Example JSON |
---|---|---|---|
RandomInt | min, max | Generates a random integer value between min and max values |
{ "type": "RandomInt", "min": 0, "max": 2147483647 } |
RandomDecimal | digits | Generates a random decimal value (BigDecimal) with the provided number of digits | { "type": "RandomDecimal", "digits": 6 } |
RandomHexadecimal | digits | Generates a random hexadecimal value (String) with the provided number of digits | { "type": "RandomHexadecimal", "digits": 8 } |
RandomString | size | Generates a random string value of the provided size characters | { "type": "RandomString", "size": 20 } |
Regex | regex | Generates a random string value from the provided regular expression | { "type": "Regex", "regex": "\\d{1,8}" } |
Uuid | Generates a random UUID value (simple format) | { "type": "Uuid" } |
|
Date | format (Optional) | Generates a Date value from the current date either in ISO format or using the provided format string | { "type": "Date", "format": "MM/dd/yyyy" } |
Time | format (Optional) | Generates a Time value from the current time either in ISO format or using the provided format string | { "type": "Time", "format": "HH:mm" } |
DateTime | format (Optional) | Generates a Date and Time (timestamp) value from the current date and time either in ISO format or using the provided format string | { "type": "DateTime", "format": "yyyy/MM/dd - HH:mm:ss.S" } |
Boolean | Generates a random boolean value | { "type": "RandomBoolean" } |
V3 Matchers
matcher | Spec Version | example configuration | description |
---|---|---|---|
Include | V3 | { "match": "include", "value": "substr" } |
This checks if the string representation of a value contains the substring. |
Integer | V3 | { "match": "integer" } |
This checks if the type of the value is an integer. |
Decimal | V3 | { "match": "decimal" } |
This checks if the type of the value is a number with decimal places. |
Number | V3 | { "match": "number" } |
This checks if the type of the value is a number. |
Timestamp | V3 | { "match": "datetime", "format": "yyyy-MM-dd HH:ss:mm" } |
Matches the string representation of a value against the datetime format |
Time | V3 | { "match": "time", "format": "HH:ss:mm" } |
Matches the string representation of a value against the time format |
Date | V3 | { "match": "date", "format": "yyyy-MM-dd" } |
Matches the string representation of a value against the date format |
Null | V3 | { "match": "null" } |
Match if the value is a null value (this is content specific, for JSON will match a JSON null) |
Boolean | V3 | { "match": "boolean" } |
Match if the value is a boolean value (booleans and the string values true and false ) |
ContentType | V3 | { "match": "contentType", "value": "image/jpeg" } |
Match binary data by its content type (magic file check) |
Values | V3 | { "match": "values" } |
Match the values in a map, ignoring the keys |