vigia 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vigia/adapters/raml.rb +30 -2
- data/lib/vigia/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 839517ce635ec40f0392b395b499995141ce6f1e
|
4
|
+
data.tar.gz: ead01a03d5b47e234b89a3b05c0ab08d015a1258
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 480f72fca1b7d0fe762def39949a025fd0f6e85502b1d49981359556f6a94724bb1683d70be14b57a3feceff594bfaf612a0bb813913dbec153d85b8f016c4f2
|
7
|
+
data.tar.gz: 086906a7d54e9aab0cc1fd1b669ca822d00308bf7bb9daf143da07cd9bde54c929f2fd672e6db27021ecac84f69fd35a00e1390cc3cec3641395dd210622526e
|
data/lib/vigia/adapters/raml.rb
CHANGED
@@ -85,7 +85,11 @@ module Vigia
|
|
85
85
|
|
86
86
|
def format_parameters(raml_hash)
|
87
87
|
raml_hash.values.each_with_object([]) do |parameter, array|
|
88
|
-
array << {
|
88
|
+
array << {
|
89
|
+
name: name_to_rfc_3986(parameter.name),
|
90
|
+
value: parameter.example,
|
91
|
+
required: !parameter.optional
|
92
|
+
}
|
89
93
|
end
|
90
94
|
end
|
91
95
|
|
@@ -104,7 +108,31 @@ module Vigia
|
|
104
108
|
def query_parameters(method)
|
105
109
|
method.apply_traits if method.traits.any? # Does this belong here RAML?
|
106
110
|
return '' if method.query_parameters.empty?
|
107
|
-
|
111
|
+
|
112
|
+
"{?#{ query_string(method) }}"
|
113
|
+
end
|
114
|
+
|
115
|
+
# RAML specification for query parameter name must comply with RFC 3986,
|
116
|
+
# However, Vigia uses `addressable` for query parameters expansion, which
|
117
|
+
# enforces RFC 6570. These two specification understand in different ways
|
118
|
+
# what it is consider to be an unreserved character. While RFC 3986 allows
|
119
|
+
# this set: `ALPHA / DIGIT / "-" / "." / "_" / "~"`, RFC 6570 only accepts
|
120
|
+
# `ALPHA / DIGIT / "_", and encoded characters in pct-encoded format `%*`
|
121
|
+
# Thus, the transformation:
|
122
|
+
def name_to_rfc_3986(string)
|
123
|
+
return if string.nil?
|
124
|
+
|
125
|
+
string.gsub(/[-.~]/,
|
126
|
+
'-' => '%2D',
|
127
|
+
'~' => '%7E',
|
128
|
+
'.' => '%2E'
|
129
|
+
)
|
130
|
+
end
|
131
|
+
|
132
|
+
def query_string(method)
|
133
|
+
method.query_parameters.keys.map do |key|
|
134
|
+
name_to_rfc_3986(key.to_s)
|
135
|
+
end.join(',')
|
108
136
|
end
|
109
137
|
end
|
110
138
|
end
|
data/lib/vigia/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vigia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Tapiador
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-02-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -246,7 +246,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
246
246
|
version: '0'
|
247
247
|
requirements: []
|
248
248
|
rubyforge_project:
|
249
|
-
rubygems_version: 2.
|
249
|
+
rubygems_version: 2.2.2
|
250
250
|
signing_key:
|
251
251
|
specification_version: 4
|
252
252
|
summary: Test your Apiary Blueprint specification on ruby
|