Skip to content

Commit

Permalink
[Fix?] Json generation for wiki works again (#1504)
Browse files Browse the repository at this point in the history
  • Loading branch information
mhamsterr authored Oct 15, 2023
1 parent 77efb2a commit 65cfa17
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Content.Server/GuideGenerator/UniversalJsonConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ public override void Write(Utf8JsonWriter writer, T obj, JsonSerializerOptions o
// If the field has a [JsonIgnore] attribute, skip it
if (Attribute.GetCustomAttribute(prop, typeof(JsonIgnoreAttribute), true) != null) continue;

// If GetIndexParameters().Length is not 0 then it means that property is indexed
// And since we cannot get its values without passing index (which type can LITERALLY BE ANYTHING) then let's just skip it
// Yeah, i know that this will lead to a potential data loss, but what i can do about it?
if (prop.GetIndexParameters().Length != 0) continue; // Corvax-Wiki

// If the property has a [JsonPropertyName] attribute, get the property name. Otherwise, use the property name.
JsonPropertyNameAttribute? attr = (JsonPropertyNameAttribute?) Attribute.GetCustomAttribute(prop, typeof(JsonPropertyNameAttribute), true);
string name = attr == null ? prop.Name : attr.Name;
Expand Down

0 comments on commit 65cfa17

Please sign in to comment.