statelint 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 41e064cf4197390ad04be13fbfca74f93380c42214bd51fa84091d75b3c58307
4
- data.tar.gz: f683ebc3ad1587dea7fe2393a37c810474bc160520fe632c9d8a778604920941
3
+ metadata.gz: 87f407ed15e1226b68291ca69d41d95d5d479fb82ec3be722ee941423530e3be
4
+ data.tar.gz: '097793ff06c444f8970ef00d586b762237c666e8c8c13344dce7fa1dd75c49e3'
5
5
  SHA512:
6
- metadata.gz: 53cf3ef609f46f3a806cd2a8177b4ee07273dd6065dddc7539c2ca51d3232f0a7859cad1916bb7e59c216eb558788bf3fbb7caa968c9f1477913a7ceb54afd41
7
- data.tar.gz: 9b3afeba573dc8fcef3f26fddf932f497661da6141e24e0774aaca9925a9b91529cd951933ffb86dbbfec2fcfce67265ee46a4dc936b4128b4a35f491d8b8bce
6
+ metadata.gz: f13ca171adf72965cd6c5e626867b8cbf4e89c7cf7b3603133df625c36f6a012d42c35aefac658f42d2f821a29ff98baf456caa72c7890eed3d382556b8a3189
7
+ data.tar.gz: 0071fe7f0d212a0b8b8bd27f67c71670455daf0f5d679ce1f0efcffe354b3b9def71ec994b80801a9d96f4e6257088203eb457ddd02f99ce74b00db7334bc73d
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- gem 'j2119', '>=0.1.0'
3
+ gem 'j2119', '>=0.3.0'
4
+ gem 'rake', '>=12.3.2'
5
+ gem 'rspec', '>=3.8.0'
@@ -21,7 +21,7 @@ module StateMachineLint
21
21
  class StateNode
22
22
 
23
23
  def initialize
24
- # We push States nodes on here when we traverse them.
24
+ # We push States nodes on here when we traverse them.
25
25
  # Then, whenever we find a "Next" or "Default" or "StartAt" node,
26
26
  # we validate that the target is there, and record that that
27
27
  # target has an incoming pointer
@@ -74,7 +74,7 @@ module StateMachineLint
74
74
  check_for_terminal(node, path, problems)
75
75
 
76
76
  check_next(node, path, problems)
77
-
77
+
78
78
  check_States_ALL(node['Retry'], path + '.Retry', problems)
79
79
  check_States_ALL(node['Catch'], path + '.Catch', problems)
80
80
 
@@ -126,7 +126,7 @@ module StateMachineLint
126
126
  if node.is_a?(Hash)
127
127
  node.each do |name, val|
128
128
  if name.end_with? '.$'
129
- if (!val.is_a?(String)) || (!J2119::JSONPathChecker.is_path?(val))
129
+ if (!val.is_a?(String)) || (!is_valid_parameters_path?(val))
130
130
  problems << "Field \"#{name}\" of Parameters at \"#{path}\" is not a JSONPath"
131
131
  end
132
132
  else
@@ -137,7 +137,18 @@ module StateMachineLint
137
137
  node.size.times {|i| probe_parameters(node[i], "#{path}[#{i}]", problems) }
138
138
  end
139
139
  end
140
-
140
+
141
+ # Check if a string that ends with ".$" is a valid path
142
+ def is_valid_parameters_path?(val)
143
+ # If the value begins with “$$”, the first dollar character is stripped off and the remainder MUST be a Path.
144
+ if val.start_with?("$$")
145
+ path_to_check = val.gsub(/^\$/, "")
146
+ J2119::JSONPathChecker.is_path?(path_to_check)
147
+ else
148
+ J2119::JSONPathChecker.is_path?(val)
149
+ end
150
+ end
151
+
141
152
  def check_for_terminal(node, path, problems)
142
153
  if node['States'] && node['States'].is_a?(Hash)
143
154
  terminal_found = false
@@ -156,12 +167,12 @@ module StateMachineLint
156
167
  end
157
168
  end
158
169
  end
159
-
170
+
160
171
  def check_States_ALL(node, path, problems)
161
172
  if !node.is_a?(Array)
162
173
  return
163
174
  end
164
-
175
+
165
176
  i = 0
166
177
  node.each do |element|
167
178
  if element.is_a?(Hash)
@@ -1,7 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'statelint'
3
- s.version = '0.2.0'
4
- s.date = '2016-09-28'
3
+ s.version = '0.3.0'
5
4
  s.summary = "State Machine JSON validator"
6
5
  s.description = "Validates a JSON object representing a State Machine"
7
6
  s.authors = ["Tim Bray"]
@@ -11,7 +10,15 @@ Gem::Specification.new do |s|
11
10
  f.match(%r{^(spec|test)/})
12
11
  end
13
12
 
14
- s.homepage = 'http://rubygems.org/gems/statelint'
15
- s.license = 'Apache 2.0'
16
- s.add_runtime_dependency "j2119"
13
+ s.homepage = 'https://github.com/awslabs/statelint'
14
+ s.license = 'Apache-2.0'
15
+
16
+ s.required_ruby_version = '>= 1.9.2'
17
+
18
+ s.add_runtime_dependency 'j2119', '>= 0.3.0'
19
+
20
+ s.metadata = {
21
+ 'source_code_uri' => 'https://github.com/awslabs/statelint',
22
+ "bug_tracker_uri" => 'https://github.com/awslabs/statelint/issues'
23
+ }
17
24
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: statelint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Bray
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-28 00:00:00.000000000 Z
11
+ date: 2019-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: j2119
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 0.3.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 0.3.0
27
27
  description: Validates a JSON object representing a State Machine
28
28
  email: timbray@amazon.com
29
29
  executables:
@@ -42,10 +42,12 @@ files:
42
42
  - lib/statelint.rb
43
43
  - lib/statelint/state_node.rb
44
44
  - statelint.gemspec
45
- homepage: http://rubygems.org/gems/statelint
45
+ homepage: https://github.com/awslabs/statelint
46
46
  licenses:
47
- - Apache 2.0
48
- metadata: {}
47
+ - Apache-2.0
48
+ metadata:
49
+ source_code_uri: https://github.com/awslabs/statelint
50
+ bug_tracker_uri: https://github.com/awslabs/statelint/issues
49
51
  post_install_message:
50
52
  rdoc_options: []
51
53
  require_paths:
@@ -54,15 +56,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
54
56
  requirements:
55
57
  - - ">="
56
58
  - !ruby/object:Gem::Version
57
- version: '0'
59
+ version: 1.9.2
58
60
  required_rubygems_version: !ruby/object:Gem::Requirement
59
61
  requirements:
60
62
  - - ">="
61
63
  - !ruby/object:Gem::Version
62
64
  version: '0'
63
65
  requirements: []
64
- rubyforge_project:
65
- rubygems_version: 2.7.7
66
+ rubygems_version: 3.0.3
66
67
  signing_key:
67
68
  specification_version: 4
68
69
  summary: State Machine JSON validator