Closed onk closed 4 years ago
And Syck is removed since Ruby 2.0.0.
I think, SafeYAML is also deprecated in Ruby 2.3+. Use YAML.safe_load instead of SafeYAML.load.
YAML.safe_load
SafeYAML.load
class ParseYaml < ResponseMiddleware define_parser do |body, parser_options| YAML.safe_load(body, **(parser_options || {})) end end
But there are two problems.
This makes a breaking change.
:deserialize_symbols
:whitelisted_tags
:custom_initializers
:raise_on_unknown_tag
:permitted_classes
:permitted_symbols
:aliases
:filename
:fallback
:symbolize_names
Supporting all of this is a bit too complicated.
2.3, 2.4:
def self.safe_load yaml, whitelist_classes = [], whitelist_symbols = [], aliases = false, filename = nil
2.5: symbolize_names is added as kwargs
symbolize_names
def self.safe_load yaml, whitelist_classes = [], whitelist_symbols = [], aliases = false, filename = nil, symbolize_names: false
2.6+: all arguments are now kwargs
def self.safe_load yaml, permitted_classes: [], permitted_symbols: [], aliases: false, filename: nil, fallback: nil, symbolize_names: false
I will merge the code change, and take the rest of the PR description into a new Issue which we can deal with separately.
And Syck is removed since Ruby 2.0.0.
I think, SafeYAML is also deprecated in Ruby 2.3+. Use
YAML.safe_load
instead ofSafeYAML.load
.But there are two problems.
SafeYAML and YAML's option is not compatible.
This makes a breaking change.
:deserialize_symbols
:whitelisted_tags
:custom_initializers
:raise_on_unknown_tag
:permitted_classes
:permitted_symbols
:aliases
:filename
:fallback
:symbolize_names
YAML.safe_load
option is not compatible in Ruby 2.3-2.7Supporting all of this is a bit too complicated.
2.3, 2.4:
2.5:
symbolize_names
is added as kwargs2.6+: all arguments are now kwargs