Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix?] Json generation for wiki works again #1504

Merged
merged 1 commit into from
Oct 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading