oas_core 1.4.1 → 1.4.2
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/lib/oas_core/version.rb +1 -1
- data/lib/oas_core/yard/oas_core_factory.rb +13 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fe76304fe743cec241e26b3b45d23ab4ec0ab6d541b13805cbe7e6d19bc65f27
|
|
4
|
+
data.tar.gz: b12c225f74e15fa422de9c8ec0867359b6c08a83ad12527dbe12c01229b6ba37
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a159cdecefb67ccb2eece07a28075f2be94d0f49d41a8097646c7508c44697bdcde29055f680d14fe61da3bfa9032a2b1746872e08b2972504c9e9ca0a494560
|
|
7
|
+
data.tar.gz: 0c34801baaf804d676bf10ae9c6d67df48733285024084d8f58bdb384e9d04b72c06ad1bd4a4815413cbb5e9e775fc5bcad993c1713175539aa868b473fa7066
|
data/lib/oas_core/version.rb
CHANGED
|
@@ -190,8 +190,7 @@ module OasCore
|
|
|
190
190
|
# @return [Hash] The processed content.
|
|
191
191
|
def raw_type_to_content(raw_type)
|
|
192
192
|
if raw_type.start_with?('JSON')
|
|
193
|
-
|
|
194
|
-
JSON.parse(json_string)
|
|
193
|
+
parse_json_content(raw_type.sub(/^JSON/, ''))
|
|
195
194
|
elsif raw_type.start_with?('Reference:')
|
|
196
195
|
ref = raw_type.sub(/^Reference:/, '').strip
|
|
197
196
|
OasCore::Spec::Reference.new(ref)
|
|
@@ -200,6 +199,18 @@ module OasCore
|
|
|
200
199
|
end
|
|
201
200
|
end
|
|
202
201
|
|
|
202
|
+
# Parses the body of a JSON example. Valid JSON is taken as written, so
|
|
203
|
+
# string values may contain apostrophes ("the request's origin"). The
|
|
204
|
+
# single-quote convenience (JSON{'key': 'value'}) is kept as a fallback
|
|
205
|
+
# for input that does not parse as strict JSON.
|
|
206
|
+
# @param json_string [String] The example body after the JSON prefix.
|
|
207
|
+
# @return [Hash] The parsed content.
|
|
208
|
+
def parse_json_content(json_string)
|
|
209
|
+
JSON.parse(json_string)
|
|
210
|
+
rescue JSON::ParserError
|
|
211
|
+
JSON.parse(json_string.gsub(/'/, '"'))
|
|
212
|
+
end
|
|
213
|
+
|
|
203
214
|
# Parses the position name and location from input text.
|
|
204
215
|
# @param input [String] The input text to parse.
|
|
205
216
|
# @return [Array] An array containing the name and location.
|