oas_parser 0.3.0 → 0.4.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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/oas_parser/response_parser.rb +21 -3
- data/lib/oas_parser/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7621b9bf0c9a6613ec55ae5e28455a9bf3027290
|
4
|
+
data.tar.gz: f7c08c893f7bb1ade6f3ab34d96e6c97a5fa184c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42643290ad8e381f90600da01b15ae04c706c33128f746c537ba2c9ef7999f55f261a60fb54ed77907cf179142c118a58befdb5a79b414cb9defd95f0e133569
|
7
|
+
data.tar.gz: 52e6ba6b817e39fdb4745629038b0210fbd2b82c3b9444f9ea33169de7d2ce0694cd9cd8373d1d5ad1e304d1a3723c14eca133a81e044b7d6cda7be8b5b8b3e4
|
data/Gemfile.lock
CHANGED
@@ -31,6 +31,11 @@ module OasParser
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
+
xml_document.xpath('//__text').each do |attribute|
|
35
|
+
value = attribute.children.last.content
|
36
|
+
attribute.parent.content = value
|
37
|
+
end
|
38
|
+
|
34
39
|
xml_document.xpath('//__attributes').each(&:remove)
|
35
40
|
|
36
41
|
xml_document.to_xml.each_line.reject { |x| x.strip == '' }.join
|
@@ -75,9 +80,15 @@ module OasParser
|
|
75
80
|
elsif object['properties']
|
76
81
|
o = {}
|
77
82
|
object['properties'].each do |key, value|
|
78
|
-
if @mode == 'xml'
|
79
|
-
|
80
|
-
|
83
|
+
if @mode == 'xml'
|
84
|
+
if is_xml_attribute?(value)
|
85
|
+
o['__attributes'] ||= {}
|
86
|
+
o['__attributes'][key] = parameter_value(value)
|
87
|
+
end
|
88
|
+
|
89
|
+
if is_xml_text?(value)
|
90
|
+
o['__text'] = parameter_value(value)
|
91
|
+
end
|
81
92
|
end
|
82
93
|
|
83
94
|
o[key] = parameter_value(value)
|
@@ -145,5 +156,12 @@ module OasParser
|
|
145
156
|
return false unless has_xml_options?(object)
|
146
157
|
object['xml']['attribute'] || false
|
147
158
|
end
|
159
|
+
|
160
|
+
def is_xml_text?(object)
|
161
|
+
# See: https://github.com/OAI/OpenAPI-Specification/issues/630#issuecomment-350680346
|
162
|
+
return false unless has_xml_options?(object)
|
163
|
+
return true if object['xml']['text'] || false
|
164
|
+
object['xml']['x-text'] || false
|
165
|
+
end
|
148
166
|
end
|
149
167
|
end
|
data/lib/oas_parser/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oas_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Butler
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|