2017-07-04 18 views
0

我已通過添加下面一行用揚鞭改變了我的API響應參數蛇情況WebApiConfig.cs如何將API響應參數轉換爲Swagger中的蛇情況?

public static class WebApiConfig 
{ 
    public static void Register(HttpConfiguration config) 
    { 
     config.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new DefaultContractResolver 
     { 
      NamingStrategy = new SnakeCaseNamingStrategy() 
     }; 
    } 
} 

目前我生成API文檔,我期待在揚鞭響應相同的設置? Swagger中有這個選項嗎?

當前文檔輸出:

enter image description here

預期的文檔輸出:

enter image description here

+0

嘗試此鏈接:https://stackoverflow.com/questions/28552567/web-api-2-how-to-return-json-with-camelcased-property-names-on-objects-and-the – Sujith

回答

相關問題