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
Defaults and Conversions have deep entanglement #6210
Comments
Yes, defaulting is tangled with conversions, and there are some caveats unfortunately. One example is that if you convert an object multiple times between different versions, you may end up having an object populated with default values from multiple versions. I am not sure that this is the intended behavior. We could use more clarity on this, and the example you mentioned. As for the tests, as far as I know, most custom conversion functions convert versioned objects (e.g. pkg/api/v1beta1) to api objects (pkg/api), or vice versa, which is likely the case you were referring to. The defaults_tests.go in each version tests encoding a versioned object and decoding it into an object of the same version again. Nowhere in that path invokes |
I'm not sure this is worth a lot of attention right now. I wanted to file On Tue, Mar 31, 2015 at 11:27 AM, Yu-Ju Hong notifications@github.com
|
Agreed that the entanglement should be addressed in a larger revamp, but the tests should still catch most of the unexpected errors until we have time for the revamp. I submitted a PR #6235. |
Default tests should be able to catch most problems now that the PR has been merged. |
|
Unfortunately, this is probably a post-1.0 item. |
Related: #7337, might be able to be closed as a dupe. |
Kicking this can down the road. |
Fixed! |
Given
If you have a custom conversion for Foo and that func does not explicitly call Convert() on FooSpec, then no conversion function will be called on Spec - not too surprising. HOWEVER - it will also bypass the defaulting function of FooSpec. This is a bit more surprising.
Worse - the tests for defaults run with no custom conversion functions loaded, it seems, so even though things pass the test, they don't actually work.
This needs some thought or AT LEAST some good docs.
The text was updated successfully, but these errors were encountered: