pact_broker 2.89.0 → 2.89.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fb2a319d08e394deac2b0ddab3c97cb09e3ef17025daebe82e54a30577a049b6
4
- data.tar.gz: b3767941da7f343cff6b14ddeca1398bb86e492b84d2447d03e59658c7d1ae31
3
+ metadata.gz: 4932100e3772127c1bccbb90c5db0e943678d14577bf163e90e61a0cd32f8685
4
+ data.tar.gz: 9b136a90d19d213f7a28c10ad518dabf0a974be80e11f6d06e199584bef2ca28
5
5
  SHA512:
6
- metadata.gz: 4373701434b40c1529c20469d860e352ffb32a100b22a2ea6774c7579ddc4a30956fc7879b1fb3f58d0e6676116cbb7ac504648178a28513b684056918e3818a
7
- data.tar.gz: a2f2b2d4b5ffb90e4ed31394d47a8a05aa75e90d2329f22cad4092930097f5958f6ccbd53ebb499c05d375bc980de62ddaf31252bd58d22ed9ff09911da106c7
6
+ metadata.gz: d6820acb97cc28b5a94e7ae939b0ee5c87e96e626956c721b19484407771735fa33f07ae61bf3d4e4cab3bb17176d348a804715a670e925ffb47d5ece07efccc
7
+ data.tar.gz: 947e0f04cd880ee4dec65eceaf1bd0d82c0975338bcf0ed1efe309f3716b70d3e666be7b36814ce0382fcf462a0cf38156b22611332ee56135622cdbf6c4ef0e
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ <a name="v2.89.1"></a>
2
+ ### v2.89.1 (2021-10-28)
3
+
4
+ #### Bug Fixes
5
+
6
+ * **clean**
7
+ * honour max_age when set in clean selector ([828420d4](/../../commit/828420d4))
8
+
9
+ * null safe navigation in case a branch head does not exist for a branch version ([4b259a81](/../../commit/4b259a81))
10
+
1
11
  <a name="v2.89.0"></a>
2
12
  ### v2.89.0 (2021-10-15)
3
13
 
@@ -68,13 +68,17 @@ module PactBroker
68
68
  end
69
69
 
70
70
  def schema
71
- PactBroker::Api::Contracts::PublishContractsSchema
71
+ api_contract_class(:publish_contracts_schema)
72
72
  end
73
73
 
74
74
  def decode_and_parse_content(contract)
75
- contract["decodedContent"] = Base64.strict_decode64(contract["content"]) rescue nil
75
+ contract["decodedContent"] = base64_decode(contract["content"])
76
76
  if contract["decodedContent"]
77
- contract["decodedParsedContent"] = PactBroker::Pacts::Parse.call(contract["decodedContent"]) rescue nil
77
+ if contract["contentType"]&.include?("json")
78
+ contract["decodedParsedContent"] = parse_json(contract["decodedContent"])
79
+ elsif contract["contentType"]&.include?("yml")
80
+ contract["decodedParsedContent"] = parse_yaml(contract["decodedContent"])
81
+ end
78
82
  end
79
83
  end
80
84
 
@@ -98,6 +102,19 @@ module PactBroker
98
102
  def conflict_notices
99
103
  @conflict_notices ||= contract_service.conflict_notices(parsed_contracts)
100
104
  end
105
+
106
+ def base64_decode(content)
107
+ Base64.strict_decode64(content) rescue nil
108
+ end
109
+
110
+ # TODO put this somewhere shareable
111
+ def parse_yaml(content)
112
+ YAML.safe_load(content, [Time, Date, DateTime]) rescue nil
113
+ end
114
+
115
+ def parse_json(content)
116
+ PactBroker::Pacts::Parse.call(content) rescue nil
117
+ end
101
118
  end
102
119
  end
103
120
  end
@@ -33,7 +33,7 @@ module PactBroker
33
33
  end
34
34
  alias_method :to_h, :to_hash
35
35
 
36
- def to_json
36
+ def to_json(_opts = nil)
37
37
  (@source_hash || to_hash).to_json
38
38
  end
39
39
 
@@ -42,7 +42,7 @@ Example: This data structure represents the way a user might specify "I want to
42
42
 
43
43
  `consumerVersionSelectors.environment`: the name of the environment containing the consumer versions for which to return the pacts. Used to further qualify `{ "deployed": true }` or `{ "released": true }`. Normally, this would not be needed, as it is recommended to verify the pacts for all currently deployed/currently supported released versions.
44
44
 
45
- `consumerVersionSelectors.latest`: true. Used in conjuction with the `tag` and `branch` properties. When used with a `branch`, it may be `true` or the key ommitted (in which case it will be inferred to be `true`). This is because it only makes sense to verify the latest pact for a branch. If a `tag` is specified, and `latest` is `true`, then the latest pact for each of the consumers with that tag will be returned. If a `tag` is specified and the latest flag is *not* set to `true`, *all* the pacts with the specified tag will be returned. (This might seem a bit weird, but it's done this way to match the syntax used for the matrix query params. See https://docs.pact.io/selectors).
45
+ `consumerVersionSelectors.latest`: true. Used in conjuction with the tag property. If a tag is specified, and latest is true, then the latest pact for each of the consumers with that tag will be returned. If a tag is specified and the latest flag is not set to true, all the pacts with the specified tag will be returned. (This might seem a bit weird, but it's done this way to match the syntax used for the matrix query params. See https://docs.pact.io/selectors).
46
46
 
47
47
  `consumerVersionSelectors.consumer`: allows a selector to only be applied to a certain consumer.
48
48
 
@@ -156,7 +156,7 @@ module PactBroker
156
156
 
157
157
  # Overwriting an existing pact with the same consumer/provider/consumer version number
158
158
  def create_pact_revision params, existing_pact
159
- logger.info "Updating existing pact publication with params #{params.reject{ |k, _v| k == :json_content}}"
159
+ logger.info "Updating existing pact publication", payload: params.reject{ |k, _v| k == :json_content }
160
160
  logger.debug "Content #{params[:json_content]}"
161
161
  pact_version_sha = generate_sha(params[:json_content])
162
162
  json_content = add_interaction_ids(params[:json_content])
@@ -17,9 +17,9 @@ module PactBroker
17
17
  end
18
18
 
19
19
  def keep_version_selectors=(keep_version_selectors)
20
- require "pact_broker/matrix/unresolved_selector"
20
+ require "pact_broker/db/clean/selector"
21
21
  @keep_version_selectors = [*keep_version_selectors].collect do | hash |
22
- PactBroker::Matrix::UnresolvedSelector.from_hash(hash)
22
+ PactBroker::DB::Clean::Selector.from_hash(hash)
23
23
  end
24
24
  end
25
25
 
@@ -1,3 +1,3 @@
1
1
  module PactBroker
2
- VERSION = "2.89.0"
2
+ VERSION = "2.89.1"
3
3
  end
@@ -27,7 +27,8 @@ module PactBroker
27
27
  end
28
28
 
29
29
  def latest?
30
- branch_head.branch_version_id == id
30
+ # Should not be possible, not to have a branch head, but have seen this error in the logs
31
+ branch_head&.branch_version_id == id
31
32
  end
32
33
 
33
34
  def version_number
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pact_broker
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.89.0
4
+ version: 2.89.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bethany Skurrie
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-10-15 00:00:00.000000000 Z
13
+ date: 2021-10-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: httparty
@@ -1836,7 +1836,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1836
1836
  - !ruby/object:Gem::Version
1837
1837
  version: '0'
1838
1838
  requirements: []
1839
- rubygems_version: 3.2.29
1839
+ rubygems_version: 3.2.30
1840
1840
  signing_key:
1841
1841
  specification_version: 4
1842
1842
  summary: See description