How to configure Swashbuckle to ignore property on model

后端 未结 15 1735
旧巷少年郎
旧巷少年郎 2020-12-02 15:10

I\'m using Swashbuckle to generate swagger documentation\\UI for a webapi2 project. Our models are shared with some legacy interfaces so there are a couple of properties I

15条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-02 15:52

    Swashbuckle now has support for Newtonsoft. https://github.com/domaindrivendev/Swashbuckle.AspNetCore#systemtextjson-stj-vs-newtonsoft

    dotnet add package --version 5.3.1 Swashbuckle.AspNetCore.Newtonsoft
    
    `services.AddSwaggerGenNewtonsoftSupport(); // explicit opt-in - needs tobe placed after AddSwaggerGen();`
    

提交回复
热议问题