occluder
occluder
CC#
Created by occluder on 11/3/2024 in #help
✅ Trouble porting to AOT JSON
and not just 'User', many other things too
49 replies
CC#
Created by occluder on 11/3/2024 in #help
✅ Trouble porting to AOT JSON
not 50 but X
49 replies
CC#
Created by occluder on 11/3/2024 in #help
✅ Trouble porting to AOT JSON
I am projecting the user back to a client
49 replies
CC#
Created by occluder on 11/3/2024 in #help
✅ Trouble porting to AOT JSON
but then we're back to the issue of having to create one for so many types
49 replies
CC#
Created by occluder on 11/3/2024 in #help
✅ Trouble porting to AOT JSON
User carries different definitions in different contexts
49 replies
CC#
Created by occluder on 11/3/2024 in #help
✅ Trouble porting to AOT JSON
a user in DomainA is not the same user as a user in DomainB
49 replies
CC#
Created by occluder on 11/3/2024 in #help
✅ Trouble porting to AOT JSON
it wouldnt only suck your mind but it'll also fill your solution with files
49 replies
CC#
Created by occluder on 11/3/2024 in #help
✅ Trouble porting to AOT JSON
imagine having to find a unique name for a 'user' class 20 times
49 replies
CC#
Created by occluder on 11/3/2024 in #help
✅ Trouble porting to AOT JSON
I think it was one of the best choices I've made
49 replies
CC#
Created by occluder on 11/3/2024 in #help
✅ Trouble porting to AOT JSON
but like I said I don't know what class implements what so I still cant do that
49 replies
CC#
Created by occluder on 11/3/2024 in #help
✅ Trouble porting to AOT JSON
I see the potential
49 replies
CC#
Created by occluder on 11/3/2024 in #help
✅ Trouble porting to AOT JSON
ah ok
49 replies
CC#
Created by occluder on 11/3/2024 in #help
✅ Trouble porting to AOT JSON
I think still your idea won't work because A.Nested != B.Nested
49 replies
CC#
Created by occluder on 11/3/2024 in #help
✅ Trouble porting to AOT JSON
The warning doesn't tell you where the confliced type is. Say for example 'User' is a nested type within a lot of my JsonSerializables. The warning doesn't tell me what classes have this as nested, so I will have to go through them from the start to find one that has it
49 replies
CC#
Created by occluder on 11/3/2024 in #help
✅ Trouble porting to AOT JSON
my reality is a little more grim I think
49 replies
CC#
Created by occluder on 11/3/2024 in #help
✅ Trouble porting to AOT JSON
when you put it like that ofc its not yeah, but what I'll have to do is something like:
[JsonSerializable(typeof(A))]
[JsonSerializable(typeof(A.Nested),TypeInfoPropertyName = "NestedA")]
[JsonSerializable(typeof(B))]
[JsonSerializable(typeof(B.Nested),TypeInfoPropertyName = "NestedB")]
...
public partial class ExampleSerializationContext : JsonSerializerContext
{
}
[JsonSerializable(typeof(A))]
[JsonSerializable(typeof(A.Nested),TypeInfoPropertyName = "NestedA")]
[JsonSerializable(typeof(B))]
[JsonSerializable(typeof(B.Nested),TypeInfoPropertyName = "NestedB")]
...
public partial class ExampleSerializationContext : JsonSerializerContext
{
}
you can imagine this getting tiresome very quickly lol
49 replies
CC#
Created by occluder on 11/3/2024 in #help
✅ Trouble porting to AOT JSON
Ah, I've explained:
me going through every nested type within those specified as [JsonSerializable] and giving them aliases is a lot of work (I have 50+ JsonSerializable types).
49 replies
CC#
Created by occluder on 11/3/2024 in #help
✅ Trouble porting to AOT JSON
are you referring to using TypeInfoPropertyName ?
49 replies
CC#
Created by occluder on 11/3/2024 in #help
✅ Trouble porting to AOT JSON
how unfortunate
49 replies
CC#
Created by occluder on 11/3/2024 in #help
✅ Trouble porting to AOT JSON
My issue has nothing to do with polymorphism or inheritence, it's having different types with conflicting names. Which normally shouldn't be a problem since they are all nested. But STJ doesn't seem to recognize that: There are multiple types named 'Nested'. Source was generated for the first one detected. Use 'JsonSerializableAttribute.TypeInfoPropertyName' to resolve this collision. This is the warning message. Obviously, me going through every nested type within those specified as [JsonSerializable] and giving them aliases is a lot of work (I have 50+ JsonSerializable types). What I've wanted to know is: Can STJ do this for me? Since all the types causing trouble are nested, can STJ somehow prepend the name of the parent class to the type? Because, reading that warning, it seems like leaving things as is will break most of deserialization
49 replies