Skip to content
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

[Question] preserve property with empty string #526

Closed
srdjos opened this issue Sep 1, 2020 · 1 comment
Closed

[Question] preserve property with empty string #526

srdjos opened this issue Sep 1, 2020 · 1 comment

Comments

@srdjos
Copy link

srdjos commented Sep 1, 2020

Hi

as I cannot find the way, I would like to ask here. In my class I have string empty property:
name: ""

after serializing, the property is removed from .yml file. Also, I tried with the ChainedEventEmitter emitter, but the null or empty value does not come to the emitter. It looks like, the property is removed before the serializer hits the emitter:

Did I miss something in the serialization process?

public override void Emit(ScalarEventInfo eventInfo, IEmitter emitter)
        {
            if (eventInfo != null && eventInfo.Source.Type == typeof(string) && 
                (eventInfo.Source.Value == null || (string)eventInfo.Source.Value==""))
            {
                if (emitter != null)
                {
                    emitter.Emit(new Scalar(string.Empty));
                }
            }
            else
            {
                base.Emit(eventInfo, emitter);
            }
        }
@srdjos srdjos changed the title [Question] preserve string empty rows [Question] preserve property with empty string Sep 1, 2020
@EdwardCooke
Copy link
Collaborator

This will be fixed when the next release goes out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants