appmap 0.46.0 → 0.47.0

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: b563a80bb77c42dd44d9fd299ed9b1a273abaf9d43256e23a0856fc06849f74c
4
- data.tar.gz: 25dead3dd3c057ee4585c8af0e85e8d495e689a18f3aa02d850bdf470c98d5ff
3
+ metadata.gz: f1f2b43daf0437ceb6073a64272148ca9168c4ac781c01e2e73c36259a3bcc7b
4
+ data.tar.gz: 2a7275d2be15d2bfcf0c2dfc898807212840506c3692232b2d049bc771a4a3b9
5
5
  SHA512:
6
- metadata.gz: 6bc94e6ee51daf178d9db411f2393538e91e4cc6a985c9b1d28ccc08feda7b6b59708d9f5f0f2cbd2184b058ff39d245c2c84e4cb25a64d5e6ddac96587c2a76
7
- data.tar.gz: 252d3955b6daedfb687091c8fb735c3f61d4cca3d7fa6ac44182c9c87f2185f53e886fa4e96f3896c35a7b5bb67e3302120dfa4e978324783b72d446f531b630
6
+ metadata.gz: 5000bdc938facaa5e181de6e3d6023c6a1b1a1e48a260545ae3245236bf271e22ab6462c16d1c73fb44b4e9bc4e6533f8be12428e2d7ff9e1c06f65ec1992bf7
7
+ data.tar.gz: 10db3cd34b1f9eb5f81070607d12b6a714b12735ac25828df4c6a3e50d0efa354ad9ff9206bc42cd2d7ccb61ffef83f663d41b3896928f0fd9bdd1e53ed4e543
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [0.47.0](https://github.com/applandinc/appmap-ruby/compare/v0.46.0...v0.47.0) (2021-05-13)
2
+
3
+
4
+ ### Features
5
+
6
+ * Emit swagger-style normalized paths instead of Rails-style ones ([5a93cd7](https://github.com/applandinc/appmap-ruby/commit/5a93cd7096ca195146a84a6733c7d502dbcd0272))
7
+
1
8
  # [0.46.0](https://github.com/applandinc/appmap-ruby/compare/v0.45.1...v0.46.0) (2021-05-12)
2
9
 
3
10
 
@@ -65,7 +65,7 @@ module AppMap
65
65
  next unless app.matches? request
66
66
  return normalized_path request, app.rack_app.routes.router if app.engine?
67
67
 
68
- return route.path.spec.to_s
68
+ return AppMap::Util.swaggerize_path(route.path.spec.to_s)
69
69
  end
70
70
  end
71
71
  end
data/lib/appmap/util.rb CHANGED
@@ -101,6 +101,16 @@ module AppMap
101
101
  end
102
102
  end
103
103
 
104
+ # Convert a Rails-style path from /org/:org_id(.:format)
105
+ # to Swagger-style paths like /org/{org_id}
106
+ def swaggerize_path(path)
107
+ path = path.split('(.')[0]
108
+ tokens = path.split('/')
109
+ tokens.map do |token|
110
+ token.gsub /^:(.*)/, '{\1}'
111
+ end.join('/')
112
+ end
113
+
104
114
  # Atomically writes AppMap data to +filename+.
105
115
  def write_appmap(filename, appmap)
106
116
  require 'fileutils'
@@ -3,7 +3,7 @@
3
3
  module AppMap
4
4
  URL = 'https://github.com/applandinc/appmap-ruby'
5
5
 
6
- VERSION = '0.46.0'
6
+ VERSION = '0.47.0'
7
7
 
8
8
  APPMAP_FORMAT_VERSION = '1.5.0'
9
9
  end
@@ -42,7 +42,7 @@ describe 'Rails' do
42
42
  hash_including(
43
43
  'http_server_request' => hash_including(
44
44
  'request_method' => 'POST',
45
- 'normalized_path_info' => '/api/users(.:format)',
45
+ 'normalized_path_info' => '/api/users',
46
46
  'path_info' => '/api/users'
47
47
  ),
48
48
  'message' => include(
@@ -197,7 +197,7 @@ describe 'Rails' do
197
197
  'http_server_request' => {
198
198
  'request_method' => 'GET',
199
199
  'path_info' => '/users/alice',
200
- 'normalized_path_info' => '/users/:id(.:format)',
200
+ 'normalized_path_info' => '/users/{id}',
201
201
  'headers' => {
202
202
  'Host' => 'test.host',
203
203
  'User-Agent' => 'Rails Testing'
data/spec/util_spec.rb CHANGED
@@ -4,8 +4,8 @@ require 'spec_helper'
4
4
  require 'appmap/util'
5
5
 
6
6
  describe AppMap::Util, docker: false do
7
- let(:subject) { AppMap::Util.method(:scenario_filename) }
8
7
  describe 'scenario_filename' do
8
+ let(:subject) { AppMap::Util.method(:scenario_filename) }
9
9
  it 'leaves short names alone' do
10
10
  expect(subject.call('foobar')).to eq('foobar.appmap.json')
11
11
  end
@@ -18,4 +18,21 @@ describe AppMap::Util, docker: false do
18
18
  expect(subject.call(fname, max_length: 50)).to eq('abcdefghijklmno-RAd_SFbH1sUZ_OXfwPsfzw.appmap.json')
19
19
  end
20
20
  end
21
+ describe 'swaggerize path' do
22
+ it 'replaces rails-style parameters' do
23
+ expect(AppMap::Util.swaggerize_path('/org/:org_id(.:format)')).to eq('/org/{org_id}')
24
+ end
25
+
26
+ it 'strips the format specifier' do
27
+ expect(AppMap::Util.swaggerize_path('/org(.:format)')).to eq('/org')
28
+ end
29
+
30
+ it 'ignores malformed parameter specs' do
31
+ expect(AppMap::Util.swaggerize_path('/org/o:rg_id')).to eq('/org/o:rg_id')
32
+ end
33
+
34
+ it 'ignores already swaggerized paths' do
35
+ expect(AppMap::Util.swaggerize_path('/org/{org_id}')).to eq('/org/{org_id}')
36
+ end
37
+ end
21
38
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appmap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.46.0
4
+ version: 0.47.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Gilpin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-12 00:00:00.000000000 Z
11
+ date: 2021-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport