Swagger options for an Service Fabric-hosted API?

274 views
Skip to first unread message

Robert Ellis

unread,
Jan 8, 2017, 12:54:29 PM1/8/17
to Swagger
My apologies if certain elements of this question are (slightly) off-topic, but it is a Swagger-centric query; and its impossible to ask the right question without putting it in context.

I want to use Azure Service Fabric services to host an API, for reliability and scalability. Because my API will be very "parameter heavy" and I would like to use complex datatypes, I am steering away from a RESTful implementation. I think WCF is a better fit. However, I do like the client-side code generation options that come with Swagger, so I would very much like to use that. I have looked into the Swagger for WCF open source project, and, if that works properly it would make a very good fit.


With the above in mind, I have these questions. Looking at the WCF documentation for Azure Service fabric at this link: https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-reliable-services-communication-wcf

They show this example code for a WCF service interface:


[ServiceContract]public interface ICalculator{    [OperationContract]    Task<int> Add(int value1, int value2);}

(a) It appears that it might be a requirement to use a Task<T> return type for Service Operations when developing WCF inside a Service Fabric

(In traditional WCF, I could just use my own classes (decorated with the appropriate serialization attributes) as return types; is this an option in Service Fabric?)


(b) If it is a requirement to use a Task<T>, what are the implications for using Swagger? I assume that Swagger will depend upon the ability to serialize a Task<T>, and I am not sure if this is going to be practical, and whether I am going to get reasonably "clean" results with Swagger if I go down this road?


If anyone has any thoughts, I'd be grateful. I want to try to design this right before I get too heavily into coding etc.


Thank you.


tony tam

unread,
Jan 9, 2017, 1:48:24 PM1/9/17
to swagger-sw...@googlegroups.com
Hi, I do believe that parameterizing in that sort of manner may be difficult to materialize into a swagger definition.  If the operation inputs and outputs are deterministic, then it should be doable.

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages