SteveDunn / Vogen

A semi-opinionated library which is a source generator and a code analyser. It Source generates Value Objects
Apache License 2.0
890 stars 46 forks source link

ServiceStack.Text framework not supported #548

Closed arteny closed 7 months ago

arteny commented 11 months ago

Describe the feature

Pls add it's support for serialization. Strings deserialized as null now.

SteveDunn commented 11 months ago

Hi - thanks for the feedback - I'll take a look at this when time permits.

arteny commented 9 months ago

Hi - thanks for the feedback - I'll take a look at this when time permits.

Waiting too much for this. Now it is deserializing as "[UNINITIALIZED]" when it is a property of object

arteny commented 9 months ago

btw I found workaround adding this method to all of my ValueObject's: public static MyValueObject Parse(string value) => From(value);

SteveDunn commented 9 months ago

I'm glad you've found a workaround. Apologies for the delay in fixing this.

SteveDunn commented 7 months ago

Hi @arteny - could you check the latest version of Vogen? It should fix this issue as it now generates Parse itself

SteveDunn commented 7 months ago

@arteny - I just checked myself. It seems that primitive numers such as int etc. are support, however, string is not. I think I need to generate a static constructor whose body is JsConfig<Name>.DeSerializeFn = Name.From;

SteveDunn commented 7 months ago

It looks like it calls any method that is public static X Parse(string s). This works, by default, with types like int because they already have that method and it is hoisted up to the wrapper.

I'll add another entry to the Conversions attribute to allow for ServiceStack.Text. When it is set, Vogen will generate the method above. Will hopefully have something shortly.

SteveDunn commented 7 months ago

This has now been implemented and will be in the next release.