Skip to content

Fix jsonpropertynames#447

Merged
Somfic merged 2 commits into
Somfic:devfrom
paulvinten:fix-jsonpropertynames
Jun 21, 2026
Merged

Fix jsonpropertynames#447
Somfic merged 2 commits into
Somfic:devfrom
paulvinten:fix-jsonpropertynames

Conversation

@paulvinten

Copy link
Copy Markdown

Attempting to read a "loadout" event shows all modules as blank, even though they show in the source journal entry.

This looks like a slight oversight in the custom ContractResolver

Paul Vinten added 2 commits June 21, 2026 16:25
A Loadout journal event nests engineering modifiers under the JSON key
"Modifiers", which LoadoutEvent.EngineeringInfo maps to its Modifications
member via [JsonProperty("Modifiers")]. EventContractResolver overwrites
every property name with the C# member name, so it looks for
"Modifications" in the JSON, never finds it, and leaves Modifications null.

This test deserialises a real Loadout with an engineered FrameShiftDrive
and asserts the modifiers bind. It fails until the resolver honours
explicit [JsonProperty] names.
The resolver replaced every property name with the C# member name, which
discarded any [JsonProperty("...")] override and broke binding for renamed
members (Modifications -> "Modifiers", IsOn -> "On"). Now the member name
is only used as a fallback when no explicit JSON name is declared.

Fixes the failing engineered-module deserialisation test.
@paulvinten paulvinten requested a review from Somfic as a code owner June 21, 2026 16:11
@github-project-automation github-project-automation Bot moved this to code review in EliteAPI Jun 21, 2026
@Somfic

Somfic commented Jun 21, 2026

Copy link
Copy Markdown
Owner

Hi Paul, thank you!

The scope of this turned out to be way wider than just for the loadout event. There are a lot of fields annotated with a JsonProperty name that is different from the original journal event field name. My guess is that around 300 fields were not properly being tracked.

Life saver!

@Somfic Somfic merged commit 789f726 into Somfic:dev Jun 21, 2026
2 checks passed
@github-project-automation github-project-automation Bot moved this from code review to user review in EliteAPI Jun 21, 2026
@Somfic Somfic moved this from user review to done in EliteAPI Jun 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: done

Development

Successfully merging this pull request may close these issues.

2 participants