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

Allow to apply custom converter to properties in YamlDotNet #233

Closed
aaubry opened this issue Jan 11, 2017 · 5 comments
Closed

Allow to apply custom converter to properties in YamlDotNet #233

aaubry opened this issue Jan 11, 2017 · 5 comments

Comments

@aaubry
Copy link
Owner

aaubry commented Jan 11, 2017

See discussion here

I'm porting my configuration file from .json to .yaml format. In Newtonsoft.Json I was able to apply attribute to a property which needed custom converter, for example

[JsonConverter(typeof(CustomIdConverter))]
public IList Users { get; set; }

How would I do the same using YamlDotNet?

I know converters should implement IYamlTypeConverter interface, but how would I apply this converter to exact property?

@tistocks
Copy link

tistocks commented Aug 24, 2020

I'll also note (even if a custom class was used), that there are times where IYamlConvertible will not suffice because (as in my case) the type is abstract or requires other forms of custom construction.

However, it asking every user of a model to always remember to use SerializerBuilder and use the WithTypeConverter process is not a good workflow.

Being able to attach the Converter to the class gives the correct use pattern without the need for someone to remember ("oh, I used this model from this library and now have to construct the serializer specially").

@alexrosenfeld10
Copy link

+1 for this

@naefp
Copy link

naefp commented Jul 27, 2021

is this planned to be implemented?

@EdwardCooke
Copy link
Collaborator

This issue appears to be abandoned, I'm going to close it.

@EdwardCooke EdwardCooke closed this as not planned Won't fix, can't repro, duplicate, stale Jan 13, 2023
@SchreinerK
Copy link

and where is the solution?

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

No branches or pull requests

6 participants