U4-8614 - JsonCamelCaseFormatter breaks the global configuration for the default JsonMediaTypeFormatter

Created by Shannon Deminick 20 Jun 2016, 13:35:17 Updated by Warren Buckley 22 Jun 2016, 12:26:47

Tags: Unscheduled

Relates to: U4-8606

The reason this happens is because we are not replacing the default formatter, we are modifying it and it is still the instance of the global one, so when it executes it means that the globa json formatter is changed.

Comments

Shannon Deminick 20 Jun 2016, 13:35:34

see rev: bc2b9ab29850e6473f7c7b6724a5f0e9e1e7a563


Warren Buckley 21 Jun 2016, 13:11:07

@Shandem can you expand details on this please for me to understand the original problem & the fix or alternatively what to test.


Shannon Deminick 21 Jun 2016, 13:21:16

The code before was modifying the 'global' JsonFormatter directly: controllerSettings.Formatters.JsonFormatter.SerializerSettings instead of replacing it so that it is only configured per controller. This means that as soon as this formatter executed, that all JsonFormatter's would have the camel case serializer applied.


Shannon Deminick 21 Jun 2016, 13:22:44

kind of hard to test but you could:

  • Re-implement the original filter under a diff name
  • put it onto an api controller
  • execute some method in that controller
  • execute a different custom api controller that doesn't have this applied and return the same model
  • you should see that the different api controller now returns came case formatting instead of normal case too


Warren Buckley 22 Jun 2016, 12:26:42

OK understand the problem & the code change makes sense, will mark as fixed @Shandem


Priority: Normal

Type: Bug

State: Fixed

Assignee:

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions:

Due in version: 7.5.0

Sprint: Sprint 36

Story Points:

Cycle: