X-Git-Url: https://git.r.bdr.sh/rbdr/forum/blobdiff_plain/b15225c9dff2864ee774a0ab1dcf19d9353ec10b..852ee620f0a2f6a83cf83eba860ca951b66bb7e2:/pacts/forumclient-forumserver.json diff --git a/pacts/forumclient-forumserver.json b/pacts/forumclient-forumserver.json index b1c7fcb..c4d529c 100644 --- a/pacts/forumclient-forumserver.json +++ b/pacts/forumclient-forumserver.json @@ -1,427 +1,972 @@ { - "consumer": { - "name": "ForumClient" - }, - "provider": { - "name": "ForumServer" - }, - "interactions": [ - { - "description": "a request to get a single post", - "providerState": "there's data", - "request": { - "method": "POST", - "path": "/graphql", - "headers": { - "content-type": "application/json" - }, - "body": { - "operationName": "GetPost", - "query": "query GetPost($id: ID!) {\n post(id: $id) {\n id\n text\n created_at\n author {\n id\n handle\n __typename\n }\n topic {\n id\n title\n __typename\n }\n __typename\n }\n }", - "variables": { - "id": "freezer" - } - }, - "matchingRules": { - "$.body.query": { - "match": "regex", - "regex": "query\\s*GetPost\\(\\$id:\\s*ID!\\)\\s*\\{\\s*post\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*text\\s*created_at\\s*author\\s*\\{\\s*id\\s*handle\\s*__typename\\s*\\}\\s*topic\\s*\\{\\s*id\\s*title\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}" - } - } - }, - "response": { - "status": 200, - "headers": { - "Content-Type": "application/json; charset=utf-8" - }, - "body": { - "data": { - "post": { - "id": "8f75eba5-6989-4dd3-b466-e464546ce374", - "text": "This is a very pacty post", - "created_at": 1619976194937, - "author": { - "id": "a805b3de-cac4-451c-a1e6-f078869c9db9", - "handle": "pacts_person" - }, - "topic": { - "id": "5c283ce1-0470-4b98-86f5-1fec9a22c9ac", - "title": "The parent pacts topic" - } - } - } - }, - "matchingRules": { - "$.body.data.post": { - "match": "type" - }, - "$.body.data.post.id": { - "match": "type" - }, - "$.body.data.post.text": { - "match": "type" - }, - "$.body.data.post.created_at": { - "match": "type" - }, - "$.body.data.post.author": { - "match": "type" - }, - "$.body.data.post.author.id": { - "match": "type" - }, - "$.body.data.post.author.handle": { - "match": "type" - }, - "$.body.data.post.topic": { - "match": "type" - }, - "$.body.data.post.topic.id": { - "match": "type" - }, - "$.body.data.post.topic.title": { - "match": "type" - } - } - } - }, - { - "description": "a request to get a single post", - "providerState": "there's no data", - "request": { - "method": "POST", - "path": "/graphql", - "headers": { - "content-type": "application/json" - }, - "body": { - "operationName": "GetPost", - "query": "query GetPost($id: ID!) {\n post(id: $id) {\n id\n text\n created_at\n author {\n id\n handle\n __typename\n }\n topic {\n id\n title\n __typename\n }\n __typename\n }\n }", - "variables": { - "id": "freezer" - } - }, - "matchingRules": { - "$.body.query": { - "match": "regex", - "regex": "query\\s*GetPost\\(\\$id:\\s*ID!\\)\\s*\\{\\s*post\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*text\\s*created_at\\s*author\\s*\\{\\s*id\\s*handle\\s*__typename\\s*\\}\\s*topic\\s*\\{\\s*id\\s*title\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}" - } - } - }, - "response": { - "status": 200, - "headers": { - "Content-Type": "application/json; charset=utf-8" - }, - "body": { - "data": { - "post": null - } - } - } - }, - { - "description": "a request to get a single post", - "providerState": "there's an error", - "request": { - "method": "POST", - "path": "/graphql", - "headers": { - "content-type": "application/json" - }, - "body": { - "operationName": "GetPost", - "query": "query GetPost($id: ID!) {\n post(id: $id) {\n id\n text\n created_at\n author {\n id\n handle\n __typename\n }\n topic {\n id\n title\n __typename\n }\n __typename\n }\n }", - "variables": { - "id": "freezer" - } - }, - "matchingRules": { - "$.body.query": { - "match": "regex", - "regex": "query\\s*GetPost\\(\\$id:\\s*ID!\\)\\s*\\{\\s*post\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*text\\s*created_at\\s*author\\s*\\{\\s*id\\s*handle\\s*__typename\\s*\\}\\s*topic\\s*\\{\\s*id\\s*title\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}" - } - } - }, - "response": { - "status": 500, - "headers": { - } - } - }, - { - "description": "a request to list the forums", - "providerState": "there's data", - "request": { - "method": "POST", - "path": "/graphql", - "headers": { - "content-type": "application/json" - }, - "body": { - "operationName": "GetForums", - "query": "query GetForums {\n forums {\n id\n glyph\n label\n position\n __typename\n }\n }", - "variables": { - } - }, - "matchingRules": { - "$.body.query": { - "match": "regex", - "regex": "query\\s*GetForums\\s*\\{\\s*forums\\s*\\{\\s*id\\s*glyph\\s*label\\s*position\\s*__typename\\s*\\}\\s*\\}" - } - } - }, - "response": { - "status": 200, - "headers": { - "Content-Type": "application/json; charset=utf-8" - }, - "body": { - "data": { - "forums": [ - { - "id": "butter", - "glyph": "⌘", - "label": "test_forums.butter", - "position": 1 - } - ] - } - }, - "matchingRules": { - "$.body.data.forums": { - "min": 1 - }, - "$.body.data.forums[*].*": { - "match": "type" - }, - "$.body.data.forums[*].id": { - "match": "type" - }, - "$.body.data.forums[*].glyph": { - "match": "type" - }, - "$.body.data.forums[*].label": { - "match": "type" - }, - "$.body.data.forums[*].position": { - "match": "type" - } - } - } - }, - { - "description": "a request to get a single forum", - "providerState": "there's data", - "request": { - "method": "POST", - "path": "/graphql", - "headers": { - "content-type": "application/json" - }, - "body": { - "operationName": "GetForum", - "query": "query GetForum($id: ID!) {\n forum(id: $id) {\n id\n glyph\n label\n position\n topics {\n id\n title\n updated_at\n ttl\n __typename\n }\n __typename\n }\n }", - "variables": { - "id": "freezer" - } - }, - "matchingRules": { - "$.body.query": { - "match": "regex", - "regex": "query\\s*GetForum\\(\\$id:\\s*ID!\\)\\s*\\{\\s*forum\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*glyph\\s*label\\s*position\\s*topics\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}" - } - } - }, - "response": { - "status": 200, - "headers": { - "Content-Type": "application/json; charset=utf-8" - }, - "body": { - "data": { - "forum": { - "id": "freezer", - "glyph": "✭", - "label": "test_forums.freezer", - "position": 3, - "topics": [ - { - "id": "629de02c-151a-4db7-bb86-43b2add8a15a", - "title": "Very pacty topic", - "updated_at": 1619954611616, - "ttl": 3601 - } - ] - } - } - }, - "matchingRules": { - "$.body.data.forum": { - "match": "type" - }, - "$.body.data.forum.glyph": { - "match": "type" - }, - "$.body.data.forum.label": { - "match": "type" - }, - "$.body.data.forum.position": { - "match": "type" - }, - "$.body.data.forum.topics": { - "min": 1 - }, - "$.body.data.forum.topics[*].*": { - "match": "type" - }, - "$.body.data.forum.topics[*].id": { - "match": "type" - }, - "$.body.data.forum.topics[*].title": { - "match": "type" - }, - "$.body.data.forum.topics[*].updated_at": { - "match": "type" - }, - "$.body.data.forum.topics[*].ttl": { - "match": "type" - } - } - } - }, - { - "description": "a request to list the forums", - "providerState": "there's no data", - "request": { - "method": "POST", - "path": "/graphql", - "headers": { - "content-type": "application/json" - }, - "body": { - "operationName": "GetForums", - "query": "query GetForums {\n forums {\n id\n glyph\n label\n position\n __typename\n }\n }", - "variables": { - } - }, - "matchingRules": { - "$.body.query": { - "match": "regex", - "regex": "query\\s*GetForums\\s*\\{\\s*forums\\s*\\{\\s*id\\s*glyph\\s*label\\s*position\\s*__typename\\s*\\}\\s*\\}" - } - } - }, - "response": { - "status": 200, - "headers": { - "Content-Type": "application/json; charset=utf-8" - }, - "body": { - "data": { - "forums": [ - - ] - } - } - } - }, - { - "description": "a request to get a single forum", - "providerState": "there's no data", - "request": { - "method": "POST", - "path": "/graphql", - "headers": { - "content-type": "application/json" - }, - "body": { - "operationName": "GetForum", - "query": "query GetForum($id: ID!) {\n forum(id: $id) {\n id\n glyph\n label\n position\n topics {\n id\n title\n updated_at\n ttl\n __typename\n }\n __typename\n }\n }", - "variables": { - "id": "freezer" - } - }, - "matchingRules": { - "$.body.query": { - "match": "regex", - "regex": "query\\s*GetForum\\(\\$id:\\s*ID!\\)\\s*\\{\\s*forum\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*glyph\\s*label\\s*position\\s*topics\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}" - } - } - }, - "response": { - "status": 200, - "headers": { - "Content-Type": "application/json; charset=utf-8" - }, - "body": { - "data": { - "forum": null - } - } - } - }, - { - "description": "a request to list the forums", - "providerState": "there's an error", - "request": { - "method": "POST", - "path": "/graphql", - "headers": { - "content-type": "application/json" - }, - "body": { - "operationName": "GetForums", - "query": "query GetForums {\n forums {\n id\n glyph\n label\n position\n __typename\n }\n }", - "variables": { - } - }, - "matchingRules": { - "$.body.query": { - "match": "regex", - "regex": "query\\s*GetForums\\s*\\{\\s*forums\\s*\\{\\s*id\\s*glyph\\s*label\\s*position\\s*__typename\\s*\\}\\s*\\}" - } - } - }, - "response": { - "status": 500, - "headers": { - } - } - }, - { - "description": "a request to get a single forum", - "providerState": "there's an error", - "request": { - "method": "POST", - "path": "/graphql", - "headers": { - "content-type": "application/json" - }, - "body": { - "operationName": "GetForum", - "query": "query GetForum($id: ID!) {\n forum(id: $id) {\n id\n glyph\n label\n position\n topics {\n id\n title\n updated_at\n ttl\n __typename\n }\n __typename\n }\n }", - "variables": { - "id": "freezer" - } - }, - "matchingRules": { - "$.body.query": { - "match": "regex", - "regex": "query\\s*GetForum\\(\\$id:\\s*ID!\\)\\s*\\{\\s*forum\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*glyph\\s*label\\s*position\\s*topics\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}" - } - } - }, - "response": { - "status": 500, - "headers": { - } - } - } - ], - "metadata": { - "pactSpecification": { - "version": "2.0.0" - } - } -} \ No newline at end of file + "consumer": { + "name": "ForumClient" + }, + "provider": { + "name": "ForumServer" + }, + "interactions": [ + { + "description": "a request to list the forums", + "providerState": "there's data", + "request": { + "method": "POST", + "path": "/graphql", + "headers": { + "content-type": "application/json" + }, + "body": { + "operationName": "GetForums", + "query": "query GetForums {\n forums {\n id\n glyph\n label\n position\n __typename\n }\n }", + "variables": {} + }, + "matchingRules": { + "$.body.query": { + "match": "regex", + "regex": "query\\s*GetForums\\s*\\{\\s*forums\\s*\\{\\s*id\\s*glyph\\s*label\\s*position\\s*__typename\\s*\\}\\s*\\}" + } + } + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json; charset=utf-8" + }, + "body": { + "data": { + "forums": [ + { + "id": "butter", + "glyph": "⌘", + "label": "test_forums.butter", + "position": 1 + } + ] + } + }, + "matchingRules": { + "$.body.data.forums": { + "min": 1 + }, + "$.body.data.forums[*].*": { + "match": "type" + }, + "$.body.data.forums[*].id": { + "match": "type" + }, + "$.body.data.forums[*].glyph": { + "match": "type" + }, + "$.body.data.forums[*].label": { + "match": "type" + }, + "$.body.data.forums[*].position": { + "match": "type" + } + } + } + }, + { + "description": "a request to get a single forum", + "providerState": "there's data", + "request": { + "method": "POST", + "path": "/graphql", + "headers": { + "content-type": "application/json" + }, + "body": { + "operationName": "GetForum", + "query": "query GetForum($id: ID!) {\n forum(id: $id) {\n id\n glyph\n label\n position\n topics {\n id\n title\n updated_at\n ttl\n __typename\n }\n __typename\n }\n }", + "variables": { + "id": "freezer" + } + }, + "matchingRules": { + "$.body.query": { + "match": "regex", + "regex": "query\\s*GetForum\\(\\$id:\\s*ID!\\)\\s*\\{\\s*forum\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*glyph\\s*label\\s*position\\s*topics\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}" + } + } + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json; charset=utf-8" + }, + "body": { + "data": { + "forum": { + "id": "freezer", + "glyph": "✭", + "label": "test_forums.freezer", + "position": 3, + "topics": [ + { + "id": "629de02c-151a-4db7-bb86-43b2add8a15a", + "title": "Very pacty topic", + "updated_at": 1619954611616, + "ttl": 3601 + } + ] + } + } + }, + "matchingRules": { + "$.body.data.forum": { + "match": "type" + }, + "$.body.data.forum.glyph": { + "match": "type" + }, + "$.body.data.forum.label": { + "match": "type" + }, + "$.body.data.forum.position": { + "match": "type" + }, + "$.body.data.forum.topics": { + "min": 1 + }, + "$.body.data.forum.topics[*].*": { + "match": "type" + }, + "$.body.data.forum.topics[*].id": { + "match": "type" + }, + "$.body.data.forum.topics[*].title": { + "match": "type" + }, + "$.body.data.forum.topics[*].updated_at": { + "match": "type" + }, + "$.body.data.forum.topics[*].ttl": { + "match": "type" + } + } + } + }, + { + "description": "a request to list the forums", + "providerState": "there's no data", + "request": { + "method": "POST", + "path": "/graphql", + "headers": { + "content-type": "application/json" + }, + "body": { + "operationName": "GetForums", + "query": "query GetForums {\n forums {\n id\n glyph\n label\n position\n __typename\n }\n }", + "variables": {} + }, + "matchingRules": { + "$.body.query": { + "match": "regex", + "regex": "query\\s*GetForums\\s*\\{\\s*forums\\s*\\{\\s*id\\s*glyph\\s*label\\s*position\\s*__typename\\s*\\}\\s*\\}" + } + } + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json; charset=utf-8" + }, + "body": { + "data": { + "forums": [] + } + } + } + }, + { + "description": "a request to get a single forum", + "providerState": "there's no data", + "request": { + "method": "POST", + "path": "/graphql", + "headers": { + "content-type": "application/json" + }, + "body": { + "operationName": "GetForum", + "query": "query GetForum($id: ID!) {\n forum(id: $id) {\n id\n glyph\n label\n position\n topics {\n id\n title\n updated_at\n ttl\n __typename\n }\n __typename\n }\n }", + "variables": { + "id": "freezer" + } + }, + "matchingRules": { + "$.body.query": { + "match": "regex", + "regex": "query\\s*GetForum\\(\\$id:\\s*ID!\\)\\s*\\{\\s*forum\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*glyph\\s*label\\s*position\\s*topics\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}" + } + } + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json; charset=utf-8" + }, + "body": { + "data": { + "forum": null + } + } + } + }, + { + "description": "a request to list the forums", + "providerState": "there's a server error", + "request": { + "method": "POST", + "path": "/graphql", + "headers": { + "content-type": "application/json" + }, + "body": { + "operationName": "GetForums", + "query": "query GetForums {\n forums {\n id\n glyph\n label\n position\n __typename\n }\n }", + "variables": {} + }, + "matchingRules": { + "$.body.query": { + "match": "regex", + "regex": "query\\s*GetForums\\s*\\{\\s*forums\\s*\\{\\s*id\\s*glyph\\s*label\\s*position\\s*__typename\\s*\\}\\s*\\}" + } + } + }, + "response": { + "status": 500, + "headers": {} + } + }, + { + "description": "a request to get a single forum", + "providerState": "there's a server error", + "request": { + "method": "POST", + "path": "/graphql", + "headers": { + "content-type": "application/json" + }, + "body": { + "operationName": "GetForum", + "query": "query GetForum($id: ID!) {\n forum(id: $id) {\n id\n glyph\n label\n position\n topics {\n id\n title\n updated_at\n ttl\n __typename\n }\n __typename\n }\n }", + "variables": { + "id": "freezer" + } + }, + "matchingRules": { + "$.body.query": { + "match": "regex", + "regex": "query\\s*GetForum\\(\\$id:\\s*ID!\\)\\s*\\{\\s*forum\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*glyph\\s*label\\s*position\\s*topics\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}" + } + } + }, + "response": { + "status": 500, + "headers": {} + } + }, + { + "description": "a request to list the forums", + "providerState": "there's an error in the response", + "request": { + "method": "POST", + "path": "/graphql", + "headers": { + "content-type": "application/json" + }, + "body": { + "operationName": "GetForums", + "query": "query GetForums {\n forums {\n id\n glyph\n label\n position\n __typename\n }\n }", + "variables": {} + }, + "matchingRules": { + "$.body.query": { + "match": "regex", + "regex": "query\\s*GetForums\\s*\\{\\s*forums\\s*\\{\\s*id\\s*glyph\\s*label\\s*position\\s*__typename\\s*\\}\\s*\\}" + } + } + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json; charset=utf-8" + }, + "body": { + "errors": [ + { + "message": "An error occurred when fetching forums" + } + ] + }, + "matchingRules": { + "$.body.errors": { + "min": 1 + }, + "$.body.errors[*].*": { + "match": "type" + }, + "$.body.errors[*].message": { + "match": "type" + } + } + } + }, + { + "description": "a request to get a single forum", + "providerState": "there's an error in the response", + "request": { + "method": "POST", + "path": "/graphql", + "headers": { + "content-type": "application/json" + }, + "body": { + "operationName": "GetForum", + "query": "query GetForum($id: ID!) {\n forum(id: $id) {\n id\n glyph\n label\n position\n topics {\n id\n title\n updated_at\n ttl\n __typename\n }\n __typename\n }\n }", + "variables": { + "id": "freezer" + } + }, + "matchingRules": { + "$.body.query": { + "match": "regex", + "regex": "query\\s*GetForum\\(\\$id:\\s*ID!\\)\\s*\\{\\s*forum\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*glyph\\s*label\\s*position\\s*topics\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}" + } + } + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json; charset=utf-8" + }, + "body": { + "errors": [ + { + "message": "An error occurred when fetching the forum" + } + ] + }, + "matchingRules": { + "$.body.errors": { + "min": 1 + }, + "$.body.errors[*].*": { + "match": "type" + }, + "$.body.errors[*].message": { + "match": "type" + } + } + } + }, + { + "description": "a request to get a single topic", + "providerState": "there's data", + "request": { + "method": "POST", + "path": "/graphql", + "headers": { + "content-type": "application/json" + }, + "body": { + "operationName": "GetTopic", + "query": "query GetTopic($id: ID!) {\n topic(id: $id) {\n id\n title\n updated_at\n ttl\n forum {\n id\n glyph\n label\n __typename\n }\n tags {\n id\n weight\n __typename\n }\n posts {\n id\n text\n created_at\n author {\n id\n handle\n __typename\n }\n __typename\n }\n __typename\n }\n }", + "variables": { + "id": "0b58959d-d448-4a4e-84b6-35e5ac0028d1" + } + }, + "matchingRules": { + "$.body.query": { + "match": "regex", + "regex": "query\\s*GetTopic\\(\\$id:\\s*ID!\\)\\s*\\{\\s*topic\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*forum\\s*\\{\\s*id\\s*glyph\\s*label\\s*__typename\\s*\\}\\s*tags\\s*\\{\\s*id\\s*weight\\s*__typename\\s*\\}\\s*posts\\s*\\{\\s*id\\s*text\\s*created_at\\s*author\\s*\\{\\s*id\\s*handle\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}" + } + } + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json; charset=utf-8" + }, + "body": { + "data": { + "topic": { + "id": "0b58959d-d448-4a4e-84b6-35e5ac0028d1", + "title": "The pacty topic of the day", + "updated_at": 1619979888906, + "ttl": 3399, + "forum": { + "id": "cucumber", + "glyph": "✽", + "label": "test_forums.cucumber" + }, + "tags": [ + { + "id": "skunk", + "weight": 44 + } + ], + "posts": [ + { + "id": "ed93530e-6f9c-4701-91ef-14f9e0ed3e26", + "text": "The content of this post is very relevant", + "created_at": 1619979889798, + "author": { + "id": "07fb2ba0-0945-464a-b215-873296710c8c", + "handle": "cucumber_fan92" + } + } + ] + } + } + }, + "matchingRules": { + "$.body.data.topic.id": { + "match": "type" + }, + "$.body.data.topic.title": { + "match": "type" + }, + "$.body.data.topic.updated_at": { + "match": "type" + }, + "$.body.data.topic.ttl": { + "match": "type" + }, + "$.body.data.topic.forum.id": { + "match": "type" + }, + "$.body.data.topic.forum.glyph": { + "match": "type" + }, + "$.body.data.topic.forum.label": { + "match": "type" + }, + "$.body.data.topic.tags": { + "min": 1 + }, + "$.body.data.topic.tags[*].*": { + "match": "type" + }, + "$.body.data.topic.tags[*].id": { + "match": "type" + }, + "$.body.data.topic.tags[*].weight": { + "match": "type" + }, + "$.body.data.topic.posts": { + "min": 1 + }, + "$.body.data.topic.posts[*].*": { + "match": "type" + }, + "$.body.data.topic.posts[*].id": { + "match": "type" + }, + "$.body.data.topic.posts[*].text": { + "match": "type" + }, + "$.body.data.topic.posts[*].created_at": { + "match": "type" + }, + "$.body.data.topic.posts[*].author": { + "match": "type" + }, + "$.body.data.topic.posts[*].author.id": { + "match": "type" + }, + "$.body.data.topic.posts[*].author.handle": { + "match": "type" + } + } + } + }, + { + "description": "a request to get a single topic", + "providerState": "there's no data", + "request": { + "method": "POST", + "path": "/graphql", + "headers": { + "content-type": "application/json" + }, + "body": { + "operationName": "GetTopic", + "query": "query GetTopic($id: ID!) {\n topic(id: $id) {\n id\n title\n updated_at\n ttl\n forum {\n id\n glyph\n label\n __typename\n }\n tags {\n id\n weight\n __typename\n }\n posts {\n id\n text\n created_at\n author {\n id\n handle\n __typename\n }\n __typename\n }\n __typename\n }\n }", + "variables": { + "id": "0b58959d-d448-4a4e-84b6-35e5ac0028d1" + } + }, + "matchingRules": { + "$.body.query": { + "match": "regex", + "regex": "query\\s*GetTopic\\(\\$id:\\s*ID!\\)\\s*\\{\\s*topic\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*forum\\s*\\{\\s*id\\s*glyph\\s*label\\s*__typename\\s*\\}\\s*tags\\s*\\{\\s*id\\s*weight\\s*__typename\\s*\\}\\s*posts\\s*\\{\\s*id\\s*text\\s*created_at\\s*author\\s*\\{\\s*id\\s*handle\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}" + } + } + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json; charset=utf-8" + }, + "body": { + "data": { + "topic": null + } + } + } + }, + { + "description": "a request to get a single topic", + "providerState": "there's a server error", + "request": { + "method": "POST", + "path": "/graphql", + "headers": { + "content-type": "application/json" + }, + "body": { + "operationName": "GetTopic", + "query": "query GetTopic($id: ID!) {\n topic(id: $id) {\n id\n title\n updated_at\n ttl\n forum {\n id\n glyph\n label\n __typename\n }\n tags {\n id\n weight\n __typename\n }\n posts {\n id\n text\n created_at\n author {\n id\n handle\n __typename\n }\n __typename\n }\n __typename\n }\n }", + "variables": { + "id": "0b58959d-d448-4a4e-84b6-35e5ac0028d1" + } + }, + "matchingRules": { + "$.body.query": { + "match": "regex", + "regex": "query\\s*GetTopic\\(\\$id:\\s*ID!\\)\\s*\\{\\s*topic\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*forum\\s*\\{\\s*id\\s*glyph\\s*label\\s*__typename\\s*\\}\\s*tags\\s*\\{\\s*id\\s*weight\\s*__typename\\s*\\}\\s*posts\\s*\\{\\s*id\\s*text\\s*created_at\\s*author\\s*\\{\\s*id\\s*handle\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}" + } + } + }, + "response": { + "status": 500, + "headers": {} + } + }, + { + "description": "a request to get a single topic", + "providerState": "there's an error in the response", + "request": { + "method": "POST", + "path": "/graphql", + "headers": { + "content-type": "application/json" + }, + "body": { + "operationName": "GetTopic", + "query": "query GetTopic($id: ID!) {\n topic(id: $id) {\n id\n title\n updated_at\n ttl\n forum {\n id\n glyph\n label\n __typename\n }\n tags {\n id\n weight\n __typename\n }\n posts {\n id\n text\n created_at\n author {\n id\n handle\n __typename\n }\n __typename\n }\n __typename\n }\n }", + "variables": { + "id": "0b58959d-d448-4a4e-84b6-35e5ac0028d1" + } + }, + "matchingRules": { + "$.body.query": { + "match": "regex", + "regex": "query\\s*GetTopic\\(\\$id:\\s*ID!\\)\\s*\\{\\s*topic\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*forum\\s*\\{\\s*id\\s*glyph\\s*label\\s*__typename\\s*\\}\\s*tags\\s*\\{\\s*id\\s*weight\\s*__typename\\s*\\}\\s*posts\\s*\\{\\s*id\\s*text\\s*created_at\\s*author\\s*\\{\\s*id\\s*handle\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}" + } + } + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json; charset=utf-8" + }, + "body": { + "errors": [ + { + "message": "An error occurred when fetching the topic" + } + ] + }, + "matchingRules": { + "$.body.errors": { + "min": 1 + }, + "$.body.errors[*].*": { + "match": "type" + }, + "$.body.errors[*].message": { + "match": "type" + } + } + } + }, + { + "description": "a request to get a single tag", + "providerState": "there's data", + "request": { + "method": "POST", + "path": "/graphql", + "headers": { + "content-type": "application/json" + }, + "body": { + "operationName": "GetTag", + "query": "query GetTag($id: ID!) {\n tag(id: $id) {\n id\n topics {\n id\n title\n updated_at\n ttl\n __typename\n }\n __typename\n }\n }", + "variables": { + "id": "pineapple" + } + }, + "matchingRules": { + "$.body.query": { + "match": "regex", + "regex": "query\\s*GetTag\\(\\$id:\\s*ID!\\)\\s*\\{\\s*tag\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*topics\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}" + } + } + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json; charset=utf-8" + }, + "body": { + "data": { + "tag": { + "id": "pineapple", + "topics": [ + { + "id": "cd038ae7-e8b4-4e38-9543-3d697e69ac34", + "title": "This topic is about pineapples", + "updated_at": 1619978944077, + "ttl": 3555 + } + ] + } + } + }, + "matchingRules": { + "$.body.data.tag.id": { + "match": "type" + }, + "$.body.data.tag.topics": { + "min": 1 + }, + "$.body.data.tag.topics[*].*": { + "match": "type" + }, + "$.body.data.tag.topics[*].id": { + "match": "type" + }, + "$.body.data.tag.topics[*].title": { + "match": "type" + }, + "$.body.data.tag.topics[*].updated_at": { + "match": "type" + }, + "$.body.data.tag.topics[*].ttl": { + "match": "type" + } + } + } + }, + { + "description": "a request to get a single tag", + "providerState": "there's no data", + "request": { + "method": "POST", + "path": "/graphql", + "headers": { + "content-type": "application/json" + }, + "body": { + "operationName": "GetTag", + "query": "query GetTag($id: ID!) {\n tag(id: $id) {\n id\n topics {\n id\n title\n updated_at\n ttl\n __typename\n }\n __typename\n }\n }", + "variables": { + "id": "pineapple" + } + }, + "matchingRules": { + "$.body.query": { + "match": "regex", + "regex": "query\\s*GetTag\\(\\$id:\\s*ID!\\)\\s*\\{\\s*tag\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*topics\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}" + } + } + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json; charset=utf-8" + }, + "body": { + "data": { + "tag": null + } + } + } + }, + { + "description": "a request to get a single tag", + "providerState": "there's a server error", + "request": { + "method": "POST", + "path": "/graphql", + "headers": { + "content-type": "application/json" + }, + "body": { + "operationName": "GetTag", + "query": "query GetTag($id: ID!) {\n tag(id: $id) {\n id\n topics {\n id\n title\n updated_at\n ttl\n __typename\n }\n __typename\n }\n }", + "variables": { + "id": "pineapple" + } + }, + "matchingRules": { + "$.body.query": { + "match": "regex", + "regex": "query\\s*GetTag\\(\\$id:\\s*ID!\\)\\s*\\{\\s*tag\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*topics\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}" + } + } + }, + "response": { + "status": 500, + "headers": {} + } + }, + { + "description": "a request to get a single tag", + "providerState": "there's an error in the response", + "request": { + "method": "POST", + "path": "/graphql", + "headers": { + "content-type": "application/json" + }, + "body": { + "operationName": "GetTag", + "query": "query GetTag($id: ID!) {\n tag(id: $id) {\n id\n topics {\n id\n title\n updated_at\n ttl\n __typename\n }\n __typename\n }\n }", + "variables": { + "id": "pineapple" + } + }, + "matchingRules": { + "$.body.query": { + "match": "regex", + "regex": "query\\s*GetTag\\(\\$id:\\s*ID!\\)\\s*\\{\\s*tag\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*topics\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}" + } + } + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json; charset=utf-8" + }, + "body": { + "errors": [ + { + "message": "An error occurred when fetching the tag" + } + ] + }, + "matchingRules": { + "$.body.errors": { + "min": 1 + }, + "$.body.errors[*].*": { + "match": "type" + }, + "$.body.errors[*].message": { + "match": "type" + } + } + } + }, + { + "description": "a request to get a single post", + "providerState": "there's data", + "request": { + "method": "POST", + "path": "/graphql", + "headers": { + "content-type": "application/json" + }, + "body": { + "operationName": "GetPost", + "query": "query GetPost($id: ID!) {\n post(id: $id) {\n id\n text\n created_at\n author {\n id\n handle\n __typename\n }\n topic {\n id\n title\n __typename\n }\n __typename\n }\n }", + "variables": { + "id": "8f75eba5-6989-4dd3-b466-e464546ce374" + } + }, + "matchingRules": { + "$.body.query": { + "match": "regex", + "regex": "query\\s*GetPost\\(\\$id:\\s*ID!\\)\\s*\\{\\s*post\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*text\\s*created_at\\s*author\\s*\\{\\s*id\\s*handle\\s*__typename\\s*\\}\\s*topic\\s*\\{\\s*id\\s*title\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}" + } + } + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json; charset=utf-8" + }, + "body": { + "data": { + "post": { + "id": "8f75eba5-6989-4dd3-b466-e464546ce374", + "text": "This is a very pacty post", + "created_at": 1619976194937, + "author": { + "id": "a805b3de-cac4-451c-a1e6-f078869c9db9", + "handle": "pacts_person" + }, + "topic": { + "id": "5c283ce1-0470-4b98-86f5-1fec9a22c9ac", + "title": "The parent pacts topic" + } + } + } + }, + "matchingRules": { + "$.body.data.post": { + "match": "type" + }, + "$.body.data.post.id": { + "match": "type" + }, + "$.body.data.post.text": { + "match": "type" + }, + "$.body.data.post.created_at": { + "match": "type" + }, + "$.body.data.post.author": { + "match": "type" + }, + "$.body.data.post.author.id": { + "match": "type" + }, + "$.body.data.post.author.handle": { + "match": "type" + }, + "$.body.data.post.topic": { + "match": "type" + }, + "$.body.data.post.topic.id": { + "match": "type" + }, + "$.body.data.post.topic.title": { + "match": "type" + } + } + } + }, + { + "description": "a request to get a single post", + "providerState": "there's no data", + "request": { + "method": "POST", + "path": "/graphql", + "headers": { + "content-type": "application/json" + }, + "body": { + "operationName": "GetPost", + "query": "query GetPost($id: ID!) {\n post(id: $id) {\n id\n text\n created_at\n author {\n id\n handle\n __typename\n }\n topic {\n id\n title\n __typename\n }\n __typename\n }\n }", + "variables": { + "id": "8f75eba5-6989-4dd3-b466-e464546ce374" + } + }, + "matchingRules": { + "$.body.query": { + "match": "regex", + "regex": "query\\s*GetPost\\(\\$id:\\s*ID!\\)\\s*\\{\\s*post\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*text\\s*created_at\\s*author\\s*\\{\\s*id\\s*handle\\s*__typename\\s*\\}\\s*topic\\s*\\{\\s*id\\s*title\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}" + } + } + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json; charset=utf-8" + }, + "body": { + "data": { + "post": null + } + } + } + }, + { + "description": "a request to get a single post", + "providerState": "there's a server error", + "request": { + "method": "POST", + "path": "/graphql", + "headers": { + "content-type": "application/json" + }, + "body": { + "operationName": "GetPost", + "query": "query GetPost($id: ID!) {\n post(id: $id) {\n id\n text\n created_at\n author {\n id\n handle\n __typename\n }\n topic {\n id\n title\n __typename\n }\n __typename\n }\n }", + "variables": { + "id": "8f75eba5-6989-4dd3-b466-e464546ce374" + } + }, + "matchingRules": { + "$.body.query": { + "match": "regex", + "regex": "query\\s*GetPost\\(\\$id:\\s*ID!\\)\\s*\\{\\s*post\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*text\\s*created_at\\s*author\\s*\\{\\s*id\\s*handle\\s*__typename\\s*\\}\\s*topic\\s*\\{\\s*id\\s*title\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}" + } + } + }, + "response": { + "status": 500, + "headers": {} + } + }, + { + "description": "a request to get a single post", + "providerState": "there's an error in the response", + "request": { + "method": "POST", + "path": "/graphql", + "headers": { + "content-type": "application/json" + }, + "body": { + "operationName": "GetPost", + "query": "query GetPost($id: ID!) {\n post(id: $id) {\n id\n text\n created_at\n author {\n id\n handle\n __typename\n }\n topic {\n id\n title\n __typename\n }\n __typename\n }\n }", + "variables": { + "id": "8f75eba5-6989-4dd3-b466-e464546ce374" + } + }, + "matchingRules": { + "$.body.query": { + "match": "regex", + "regex": "query\\s*GetPost\\(\\$id:\\s*ID!\\)\\s*\\{\\s*post\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*text\\s*created_at\\s*author\\s*\\{\\s*id\\s*handle\\s*__typename\\s*\\}\\s*topic\\s*\\{\\s*id\\s*title\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}" + } + } + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json; charset=utf-8" + }, + "body": { + "errors": [ + { + "message": "An error occurred when fetching the post" + } + ] + }, + "matchingRules": { + "$.body.errors": { + "min": 1 + }, + "$.body.errors[*].*": { + "match": "type" + }, + "$.body.errors[*].message": { + "match": "type" + } + } + } + } + ], + "metadata": { + "pactSpecification": { + "version": "2.0.0" + } + } +}