4

I have my API documented and versioned previously using Swashbuckle.AspNetCore, Microsoft.AspNetCore.Mvc.Api.Analyzers, Microsoft.AspNetCore.Mvc.Versioning and Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer.

Everything was fine but all of a sudden today I noticed that JsonPatchDocument Not getting displayed properly in my swagger. I couldn't figure out what's the root cause. But I suspect some Nuget Package Upgrade?

Previously I remember the JsonPatchDocument in my swagger as something similar below:

{
   "Operations": [
     {
       "value": {},
       "path": "string",
       "op": "string",
       "from": "string"
     }
   ]
}

But now it shows something else,

{
  "ContractResolver": {}
}

Please assist on what I'm missing

3
  • Hey man, were you ever able to figure out what was the issue and fix it? Commented Jan 6, 2021 at 15:50
  • nope. will post the answer once I resolve this. Commented Jan 9, 2021 at 10:34
  • Check that the AddNewtonsoftJson() extension method exists in the Startup.cs (Services.AddControllers().AddNewtonsoftJson()). Commented Apr 2, 2022 at 16:42

1 Answer 1

1

Make sure you are added the AddNewtonsoftJson in program.cs after install the Microsoft.AspNetCore.Mvc.NewtonsofJson

should be like this : builder.Services.AddControllers().AddNewtonsoftJson();

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.