SteveDunn / Vogen

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

ServiceStack.Text framework not supported #548

Closed arteny closed 4 months ago

arteny commented 8 months ago

Describe the feature

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

SteveDunn commented 8 months ago

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

arteny commented 7 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 7 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 7 months ago

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

SteveDunn commented 4 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 4 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 4 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 4 months ago

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