planetarium / mimir

A backend service that provides 9c-related utility APIs.
https://nine-chronicles.dev/
GNU Affero General Public License v3.0
1 stars 5 forks source link

Use .NET builtin JsonNode instead of 3rd-party #358

Closed TheMarvelFan closed 6 hours ago

TheMarvelFan commented 2 days ago

Fixes issue https://github.com/planetarium/mimir/issues/342

Below are the listed files that required modification to 'System.Text.Json' types:

Mimir.MongoDB/Bson/Serialization/Serializers/Lib9c/Items/TradableMaterialSerializer.cs Mimir.MongoDB/Json/Converters/BigIntegerJsonConverter.cs Mimir.MongoDB/Json/Converters/MaterialAndIntDictionaryJsonConverter.cs Mimir.MongoDB/Json/Extensions/MimirBsonDocumentExtensions.cs

Note: Please merge PR #357 before merging this to avoid potential merge conflicts.

This PR is a redo of PR #349 so that it can be counted by Hacktoberfest.

TheMarvelFan commented 2 days ago

@moreal

Since any fields or properties that start with "Bencoded" are dynamic, a custom contract resolver approach is not directly available in System.Text.Json. Instead, I have created a custom JSON converter that inspects the property names, and ignores the ones beginning with 'Bencoded'