Skip to content

Commit

Permalink
Merge pull request #335 from mito5525/compatibility_psych4
Browse files Browse the repository at this point in the history
Support Psych v4.0.0
  • Loading branch information
ota42y authored Nov 25, 2021
2 parents c9b4381 + d6ba03c commit 4d4f202
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/committee/drivers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ def self.load_from_json(schema_path)
# @param [String] schema_path
# @return [Committee::Driver]
def self.load_from_yaml(schema_path)
load_from_data(YAML.load_file(schema_path), schema_path)
data = YAML.respond_to?(:unsafe_load_file) ? YAML.unsafe_load_file(schema_path) : YAML.load_file(schema_path)
load_from_data(data, schema_path)
end

# load and build drive from file
Expand Down
3 changes: 3 additions & 0 deletions test/data/openapi3/normal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ paths:
properties:
string_1:
type: string
time_string_1:
type: string
exmaple: 2021-09-22T05:36:45Z
array_1:
type: array
items:
Expand Down
6 changes: 5 additions & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ def open_api_2_form_data
end

def open_api_3_data
YAML.load_file(open_api_3_schema_path)
if YAML.respond_to?(:unsafe_load_file)
YAML.unsafe_load_file(open_api_3_schema_path)
else
YAML.load_file(open_api_3_schema_path)
end
end

def hyper_schema_schema_path
Expand Down

0 comments on commit 4d4f202

Please sign in to comment.