feat: Adds GUID support for codegen (#1251)
This commit is contained in:
parent
58acfcabad
commit
32c15f214b
4 changed files with 7 additions and 14 deletions
|
|
@ -3,7 +3,7 @@
|
||||||
"isRoot": true,
|
"isRoot": true,
|
||||||
"tools": {
|
"tools": {
|
||||||
"modernuoschemagenerator": {
|
"modernuoschemagenerator": {
|
||||||
"version": "2.6.0",
|
"version": "2.6.1",
|
||||||
"commands": [
|
"commands": [
|
||||||
"ModernUOSchemaGenerator"
|
"ModernUOSchemaGenerator"
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -21,16 +21,9 @@ namespace Server.Json;
|
||||||
|
|
||||||
public class GuidConverter : JsonConverter<Guid>
|
public class GuidConverter : JsonConverter<Guid>
|
||||||
{
|
{
|
||||||
public override Guid Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
public override Guid Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) =>
|
||||||
{
|
reader.GetGuid();
|
||||||
if (Guid.TryParse(reader.GetString()!, out var guid))
|
|
||||||
{
|
|
||||||
return guid;
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new JsonException("Guid must be in the correct format");
|
public override void Write(Utf8JsonWriter writer, Guid value, JsonSerializerOptions options) =>
|
||||||
}
|
writer.WriteStringValue(value.ToString());
|
||||||
|
|
||||||
public override void Write(Utf8JsonWriter writer, Guid value, JsonSerializerOptions options)
|
|
||||||
=> writer.WriteStringValue(value.ToString());
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@
|
||||||
<PackageReference Include="Zlib.Bindings" Version="1.10.1" />
|
<PackageReference Include="Zlib.Bindings" Version="1.10.1" />
|
||||||
|
|
||||||
<PackageReference Include="ModernUO.Serialization.Annotations" Version="2.6.0" />
|
<PackageReference Include="ModernUO.Serialization.Annotations" Version="2.6.0" />
|
||||||
<PackageReference Include="ModernUO.Serialization.Generator" Version="2.6.0" />
|
<PackageReference Include="ModernUO.Serialization.Generator" Version="2.6.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<AdditionalFiles Include="Migrations/*.v*.json" />
|
<AdditionalFiles Include="Migrations/*.v*.json" />
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@
|
||||||
<PackageReference Include="Zstd.Binaries" Version="1.5.1" />
|
<PackageReference Include="Zstd.Binaries" Version="1.5.1" />
|
||||||
|
|
||||||
<PackageReference Include="ModernUO.Serialization.Annotations" Version="2.6.0" />
|
<PackageReference Include="ModernUO.Serialization.Annotations" Version="2.6.0" />
|
||||||
<PackageReference Include="ModernUO.Serialization.Generator" Version="2.6.0" />
|
<PackageReference Include="ModernUO.Serialization.Generator" Version="2.6.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<AdditionalFiles Include="Migrations/*.v*.json" />
|
<AdditionalFiles Include="Migrations/*.v*.json" />
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue