Having input parameters generated in json when using FromUri

17 views
Skip to first unread message

Rem

unread,
Jan 17, 2017, 6:24:21 PM1/17/17
to Swagger
Hello,

I am using FromUri to bind my request with WebAPI as follow :

In my core:

type Info= 
    { Id: double
      Label: string
      City : string
      Property1 : string
 }

In my controller:

[<HttpGet>]
[<Route("infos")>]
[<SwaggerResponse(HttpStatusCode.OK, "", typeof<seq<Data.Core.DataAccess.ProjectDBML.MyTable>>)>]
[<SwaggerResponse(HttpStatusCode.NotFound)>]
[<SwaggerOperation(operationId="GetInfos")>]
member this.GetInfos([<FromUri>] p:Info) =
    let results = getInfos p
    let results = results.ToList()
    this.Ok(results)


The json generated does not see any input params.


"/api/v1/bdr/infos":{"get":{"tags":["INFOS"],"operationId":"GetInfos","consumes":[],"produces":["application/json","text/json","text/html"],"parameters":[],"responses":{"200":{"description":"","schema":{"type":"array","items":{"$ref":"#/definitions/ETL_Meteor_BDRClients"}}},"404":{"description":"NotFound"}},"deprecated":false}},


Is there a way to decorate the controller so that parameters is populated properly in the json contract ?

Thank you.

Rem

unread,
Jan 18, 2017, 1:12:51 PM1/18/17
to Swagger

Just adding[<CLIMutable>]on top of my object does the trick.
It will generate the parameters.
Reply all
Reply to author
Forward
0 new messages