-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add ignore_serialize
for YAML::Serializable
#13556
Conversation
Thanks @meatball133! Overall it looks good, but the tests are failing. I haven't investigated the reasons, but it seems only the new tests are affected. |
It is one test case there should be one extra space. I did some tests with my new locally compiled Crystal, and it didn't have that space. But on the online test, it does. I will add the space in any case and hopefully shouldn't fail. |
Alright seems like different operating system wants different results. |
The trailing whitespace is tied to the libyaml version. It is fixed in 0.2.5: yaml/libyaml#186 Reproduction: require "yaml"
class Foo
include YAML::Serializable
@[YAML::Field(emit_null: true)]
getter x : String?
def initialize
end
end
# "---\nx: \n" before 0.2.5
Foo.new.to_yaml # => "---\nx:\n" |
So I don't understand, do I have to do something or will this issue automatically fix itself? |
The specs must either strip all whitespace at the end of each line or use different expectations depending on |
Co-authored-by: Johannes Müller <straightshoota@gmail.com>
YAML::Serializable
ignore_serialize
for YAML::Serializable
Co-authored-by: Johannes Müller <straightshoota@gmail.com>
resolves #13345
Based on the pr of #11804, and should as that pr not include any breaking changes.