Chemistry JSON dump tool and companion GitHub Action (#6134)

* fuck

* oh boy

* Sorted every chem into guide groups

* WHY ARE YOU NOT ABSTRACT

* removes the target thing in favor of simply generating everything.

* eee

* Add group for med

* Update wiki JSON generation to use System.Text.Json

* Fix error on shutdown during wiki JSON generation

* First pass at automatic wiki workflow

* Add a temporary workaround while the build is continuing to give errors

* Update workflow to reference correct API url, track dependency.

* Compile wiki actions into one job rather than two

* Update page name to reference editable page

* Add other JSON file and parameterize root page path

* A few steps closer to using `System.Text.Json` to serialize properly

* Revert System.Text.Json and return to Newtonsoft.Json.

* Revert the revert. Return to System.Text.Json.

This reverts commit a5ea98dfdcfab3f605ac4d82d3b110f099324308.

* Add and register UniversalJsonConverter class.

* Narrow triggers for update-wiki GitHub action.

Co-authored-by: moonheart08 <moonheart08@users.noreply.github.com>
This commit is contained in:
Sam Weaver
2022-01-17 14:50:02 -05:00
committed by GitHub
parent 5f3e83e493
commit 40e2e78e0f
27 changed files with 591 additions and 44 deletions

View File

@@ -1,6 +1,8 @@
using System;
using System.Globalization;
using System.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
using Robust.Shared.Serialization;
namespace Content.Shared.FixedPoint
@@ -10,6 +12,7 @@ namespace Content.Shared.FixedPoint
/// To enforce this level of precision, floats are shifted by 2 decimal points, rounded, and converted to an int.
/// </summary>
[Serializable]
[JsonConverter(typeof(FixedPointJsonConverter))]
public struct FixedPoint2 : ISelfSerialize, IComparable<FixedPoint2>, IEquatable<FixedPoint2>, IFormattable
{
private int _value;
@@ -291,4 +294,19 @@ namespace Content.Shared.FixedPoint
return acc;
}
}
public class FixedPointJsonConverter : JsonConverter<FixedPoint2>
{
public override void Write(Utf8JsonWriter writer, FixedPoint2 value, JsonSerializerOptions options)
{
writer.WriteNumberValue(value.Float());
}
public override FixedPoint2 Read(ref Utf8JsonReader reader, Type objectType, JsonSerializerOptions options)
{
// Throwing a NotSupportedException here allows the error
// message to provide path information.
throw new NotSupportedException();
}
}
}