WIP
[demos/example-siren] / spring-consumer / target / pacts / SpringConsumer-Siren Order Provider.json
index 323956d..f04e0d3 100644 (file)
       },
       "response": {
         "body": {
-
+          "class": [
+            "entity"
+          ],
+          "entities": [
+                        [
+              {
+                "action": [
+                  {
+                    "href": "http://localhost:8080/1234",
+                    "method": "PUT",
+                    "name": "update"
+                  },
+                  {
+                    "href": "http://localhost:8080/1234",
+                    "method": "DELETE",
+                    "name": "delete"
+                  }
+                ],
+                "class": [
+                  "entity"
+                ],
+                "links": [
+                  {
+                    "href": "http://localhost:8080/orders/RegexpMatcher(regex=\\d+, value=1234)",
+                    "rel": [
+                      "self"
+                    ]
+                  }
+                ],
+                "properties": {
+                  "id": "1234",
+                  "rel": [
+                    "item"
+                  ]
+                }
+              }
+            ]
+          ],
+          "links": [
+            {
+              "href": "http://localhost:8080/orders",
+              "rel": [
+                "self"
+              ]
+            }
+          ]
         },
-        "headers": {
-          "Content-Type": "application/vnd.siren+json"
+        "generators": {
+          "body": {
+            "$.entities[0].entities[*].links[0].href": {
+              "example": "http://localhost:8080/orders/RegexpMatcher(regex=\\d+, value=1234)",
+              "regex": ".*\\/(\\Qorders\\E\\/\\QRegexpMatcher(regex=\\d+, value=1234)\\E)$",
+              "type": "MockServerURL"
+            },
+            "$.entities[0].entities[*][0].href": {
+              "example": "http://localhost:8080/1234",
+              "regex": ".*\\/(\\Q1234\\E)$",
+              "type": "MockServerURL"
+            },
+            "$.entities[0].entities[*][1].href": {
+              "example": "http://localhost:8080/1234",
+              "regex": ".*\\/(\\Q1234\\E)$",
+              "type": "MockServerURL"
+            },
+            "$.links[0].href": {
+              "example": "http://localhost:8080/orders",
+              "regex": ".*\\/(\\Qorders\\E)$",
+              "type": "MockServerURL"
+            }
+          }
         },
-        "status": 200
-      }
-    },
-    {
-      "description": "get root",
-      "request": {
-        "method": "GET",
-        "path": "/"
-      },
-      "response": {
         "headers": {
           "Content-Type": "application/vnd.siren+json"
         },
+        "matchingRules": {
+          "body": {
+            "$.entities[0]": {
+              "combine": "AND",
+              "matchers": [
+                {
+                  "match": "type"
+                }
+              ]
+            },
+            "$.entities[0].entities[*].action": {
+              "combine": "AND",
+              "matchers": [
+                {
+                  "match": "arrayContains",
+                  "variants": [
+                    {
+                      "generators": {
+                        "$.href": {
+                          "example": "http://localhost:8080/1234",
+                          "regex": ".*\\/(\\Q1234\\E)$",
+                          "type": "MockServerURL"
+                        }
+                      },
+                      "index": 0,
+                      "rules": {
+                        "$.href": {
+                          "combine": "AND",
+                          "matchers": [
+                            {
+                              "match": "regex",
+                              "regex": ".*\\/(\\Q1234\\E)$"
+                            }
+                          ]
+                        },
+                        "$.method": {
+                          "combine": "AND",
+                          "matchers": [
+                            {
+                              "match": "type"
+                            }
+                          ]
+                        },
+                        "$.name": {
+                          "combine": "AND",
+                          "matchers": [
+                            {
+                              "match": "type"
+                            }
+                          ]
+                        }
+                      }
+                    },
+                    {
+                      "generators": {
+                        "$.href": {
+                          "example": "http://localhost:8080/1234",
+                          "regex": ".*\\/(\\Q1234\\E)$",
+                          "type": "MockServerURL"
+                        }
+                      },
+                      "index": 1,
+                      "rules": {
+                        "$.href": {
+                          "combine": "AND",
+                          "matchers": [
+                            {
+                              "match": "regex",
+                              "regex": ".*\\/(\\Q1234\\E)$"
+                            }
+                          ]
+                        },
+                        "$.method": {
+                          "combine": "AND",
+                          "matchers": [
+                            {
+                              "match": "type"
+                            }
+                          ]
+                        },
+                        "$.name": {
+                          "combine": "AND",
+                          "matchers": [
+                            {
+                              "match": "type"
+                            }
+                          ]
+                        }
+                      }
+                    }
+                  ]
+                }
+              ]
+            },
+            "$.entities[0].entities[*].links[0].href": {
+              "combine": "AND",
+              "matchers": [
+                {
+                  "match": "regex",
+                  "regex": ".*\\/(\\Qorders\\E\\/\\QRegexpMatcher(regex=\\d+, value=1234)\\E)$"
+                }
+              ]
+            },
+            "$.entities[0].entities[*].properties.id": {
+              "combine": "AND",
+              "matchers": [
+                {
+                  "match": "type"
+                }
+              ]
+            },
+            "$.links[0].href": {
+              "combine": "AND",
+              "matchers": [
+                {
+                  "match": "regex",
+                  "regex": ".*\\/(\\Qorders\\E)$"
+                }
+              ]
+            }
+          }
+        },
         "status": 200
       }
     }