-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Basic config passing as string --ECL * MInor changes to options field --ECL * Store buildOptions as object in MongoDB rather than string * (Oops, incomplete commit) * Fix without using Json.net * No json.net * Fixed usings * Fixes as per PR review
- Loading branch information
Showing
10 changed files
with
57 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
namespace Serval.Shared.Utils; | ||
|
||
public class ObjectToInferredTypesConverter : JsonConverter<object> | ||
{ | ||
public override object Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => | ||
reader.TokenType switch | ||
{ | ||
JsonTokenType.True => true, | ||
JsonTokenType.False => false, | ||
JsonTokenType.Number when reader.TryGetInt64(out long l) => l, | ||
JsonTokenType.Number => reader.GetDouble(), | ||
JsonTokenType.String when reader.TryGetDateTime(out DateTime datetime) => datetime, | ||
JsonTokenType.String => reader.GetString()!, | ||
_ => JsonDocument.ParseValue(ref reader).RootElement.Clone() | ||
}; | ||
|
||
public override void Write(Utf8JsonWriter writer, object objectToWrite, JsonSerializerOptions options) => | ||
JsonSerializer.Serialize(writer, objectToWrite, objectToWrite.GetType(), options); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters