Accept YAML input for profile#1209
Conversation
|
Can you add POD documentation for from_yaml() and to_yaml()? Some documentation for json2yaml.pl is needed. Can you add that as POD into the script? Why is profile.json kept? I cannot see that profile.yaml is read. profile_additional_properties.json should also be provided in yaml format, shouldn't it? |
lib/Zonemaster/Engine/Profile.pm
Outdated
| sub to_yaml { | ||
| my ( $self ) = @_; | ||
|
|
||
| return Dump( $self->{q{profile}} ); |
There was a problem hiding this comment.
The automatic exports of Dump() and Load() by YAML::XS makes this code slightly confusing, because Dump() sounds like a function that could have been exported by Data::Dumper (which, by the way, does provide a Dump function)…
I suggest changing use YAML::XS; to use YAML::XS qw(); to prevent the automatic exports, then calling the Dump function with its fully-qualified name, YAML::XS::Dump().
There was a problem hiding this comment.
Good point. I'll provide an update. Update provided.
Done.
This PR is about accepting YAML input, not replacing the JSON input.
Not necessarily. Since the end goal of using YAML as the input format, is to have only one profile file with commented values, I think this can be left for a future work (when a new unified |
I can see the documentation in Profile.pm. Thanks. Could you provide some documentation for json2yaml.pl too?
I cannot see that the profile.yaml is used. Is it? If not, what is the purpose of it?
That is fine, but then profile_additional_properties.json should be incorporated in profile.yaml, shouldn't they? |
I forgot to add it.
Not yet. Its current purpose is to document how we could use it and start from there.
This is the idea. Nevertheless I'd like to keep this PR about providing the basic methods to deal with a YAML formatted profile. |
marc-vanderwal
left a comment
There was a problem hiding this comment.
Looks good to me.
Purpose
This PR allows to pass the profile as a YAML file.
This is the first step towards replacing the current JSON input format. JSON does not support comments, and it would be nice to provide a profile document that supports comments for values and properties.
Context
Meeting discussion on 2023-03-09.
Changes
from_yaml()andto_yaml()methods in Profile.pmshare/profile.yamlutil/json2yaml.plHow to test this PR
Unit test should pass.