Closed warriordog closed 1 year ago
Blocked by the linked research stories.
No longer blocked - working this along with #78
Idea:
ASBaseConstructor
(NOT converter) which constructs a lone ASBase
type from input JSON. This will contain most of the logic from the existing ASTypeConverter
. Research: will this let us remove the manual conversion??TypeMapConverter
which builds a type graph based on the input. This is 100% based on the input and takes no heuristics from the declared type. Uses ASBaseConstructor
ASBaseConverter
which converts a TypeMap
from the input (using TypeMapConverter
) then extracts the requested type from it.
graph by manually calling
ASBaseConstructor`.ASTypeConverter
assumes that anything deriving from ASType has no properties. As such, it can work like this:
TypeMap
Problem: collections (resolved by #82)
Idea 2 (attempting to remove manual conversion):
ASTypeConverter
:
TypeMap
TypeMap
TypeMapConverter
:
JsonNode
to hold outputTrySerializeIntoValue
. If multiple types have this, then bail.JsonNode
created aboveTypeMap
string
-> ASLink
object
-> ASObject
JsonException
TryDeserialize
NarrowJsonType
TODO: see above "change needed" comment
Exploring custom contract resolver as possible help
Easier solution - I think we can just remove the TypeMap from the entity and then add a no-args constructor overload.
Update: this should work! We need to replace ASLinkEntity.HasOnlyHRef, since it depends on ASTypeEntity. but that's the only broken case.
Done
Implement new Type Cache and JSON converters based on the result of research in #77.
Additional work merged from #78: Design and build new TypeInfo cache. Ideally, we can make the entire conversion process fully generic like JsonPropertyInfo. That opens up the possibility of using Static Virtual Interface Members to avoid some reflection.
Additional work merged from #51: AS types should be compared with exact case. An older version of this code was incorrectly case-ignorant, and some vestiges of that still remain. Everything should be fixed to be case-sensitive, with tests to verify this behavior.
More info: https://github.com/warriordog/ActivityPubSharp/issues/74#issuecomment-1660685784