-
Notifications
You must be signed in to change notification settings - Fork 129
Support legacy boolean yes|no|on|off
but warn user about incompatibility
#382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
loader/loader_test.go
Outdated
} | ||
|
||
func TestLoadLegacyBoolean(t *testing.T) { | ||
_, err := loadYAML(` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the goal is to support legacy booleans, actual
checking should not be removed in the test code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry we forgot to update the issue title, we won't support the legacy option anymore as they are deprecated since 2009
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that you don't want to support legacy YAML in the future.
However, Docker Compose v2.16 (compose-go v1.12.0) did support legacy YAML. If you are going to make breaking changes, you should do it when we bump the major version using semantic versioning.
As @ndeloof initially proposed, it is a good idea to display warnings in the current major version and make updates that will stop support in the future.
This approach will help users prepare for the changes and avoid any sudden disruptions.
loader/interpolate.go
Outdated
case "false": | ||
return false, nil | ||
case "y", "yes", "on": | ||
return true, fmt.Errorf("%q for boolean is not supported by YAML 1.2, please use `true`", value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the toBoolean
function returns err, case map[string]interface{}:
of the recursiveInterpolate
function in interpolation/interpolation.go
will set the output to nil.
With the current structure of the code, it seems to be difficult to successfully load with warnings.
Wouldn't it be better to just fix the case string:
in the recursiveInterpolate
function in interpolation/interpolation.go
, just restore the legacy boolean support, and put the warning in a separate PR?
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
yes|no|on|off
but warn user about incompatibility
After debate within the team, we decided to prefer backward compatibility, warning user about this misuse of yaml, and will plan removal for this legacy syntax in a future release |
No description provided.