2017-05-11 4 views
0

私はSearchProfilesModelのオブジェクトを受け取るコントローラを持っています。これはSearchProfilesの配列と基本クラスのいくつかのプロパティで構成されます。 方法:.NETの配列パラメータの説明をスローガン

[HttpGet] 
[ResponseType(typeof(List<UserSearchResult>))] 
[Route("SearchWithParams")] 
public async Task<HttpResponseMessage> 
    SearchWithParams([FromUri] SearchProfilesModel model) 
{ 
    // Some logic 
    return Request.CreateResponse(HttpStatusCode.OK, result); 
} 

Modelクラス:

public class SearchProfilesModel : LoginRequiredModel 
{ 
    [Required] 
    [JsonProperty("search_profiles")] 
    public List<SearchProfileViewModel> ProfilesList { get; set; } 
} 

リスト項目クラス:

public class SearchProfileViewModel 
{ 
    [JsonProperty("name")] 
    public string Name { get; set; } 
    [JsonProperty("surname")] 
    public string Surname { get; set; } 
    [JsonProperty("facebook_id")] 
    public string FacebookId { get; set; } 
    [JsonProperty("email")] 
    public string Email { get; set; } 
} 

I`m私のコントローラをテストする(libがswashbuckle)闊歩UIを使用して、しかしときに発生この方法のヘルプページは次のとおりです。 Help page

私の質問は - 何らかの形で(SearchProfileViewModelから)リスト項目の構造をパラメータで表示できますか?そしてもしできれば - どう? P.P. - 私の英語は申し訳ありません、私の母国語ではありません。

+1

可能性のある重複した[闊歩2.0を使用して、複雑なオブジェクトの配列を説明して](のhttp://のstackoverflow。 com/questions/38088722/complex-objects-swagger-2-0を使用した配列の記述 –

答えて

0

あなたのオブジェクトの構造が生成されドキュメントであり、鉱山を見てみましょう:の http://swashbuckletest.azurewebsites.net/swagger/docs/v1

{ 
"swagger": "2.0", 
"info": {...}, 
"host": "swashbuckletest.azurewebsites.net", 
"schemes": [...], 
"paths": {...}, 
"definitions": { 
    "Data": { 
     "type": "object", 
     "properties": { 
      "integ": { 
       "format": "int32", 
       "type": "integer", 
       "example": 123 
      }, 
      "doub": { 
       "format": "double", 
       "type": "number", 
       "example": 9858.216 
      }, 
      "boolea": { 
       "type": "boolean" 
      }, 
      "guid": { 
       "format": "uuid", 
       "type": "string", 
       "example": "f5849915-43c8-434c-92a7-7383d1acb631" 
      }, 
      "date": { 
       "format": "date-time", 
       "type": "string" 
      } 
     } 
    }, 
... 
関連する問題