pact-foundation / pact-ruby

Enables consumer driven contract testing, providing a mock service and DSL for the consumer project, and interaction playback and verification for the service provider project.
https://pact.io
MIT License
2.17k stars 216 forks source link

Pact V3 Tracking Issue #318

Open YOU54F opened 3 months ago

YOU54F commented 3 months ago

We would like to implement Pact V3 Specification support for Pact Ruby

Current status

Required V3 Features

Implementation notes

Validation

V3 Related Issues

Will be tagging and closing related v3/v4 issues, and linking to this meta issue

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