swaggerwcf
swaggerwcf copied to clipboard
string[] Parameter, enum Return Value
I have integrated SwaggerWcf 0.2.15.0 in our WCF (SOAP + REST) application.
While most of the API seems to be exported without problems, there are three methods, which are not exported correctly.
[OperationContract]
[WebGet]
[SwaggerWcfTag("Camera")]
CameraStatus GetCameraStatus(string cameraID);
[OperationContract]
[WebInvoke]
[SwaggerWcfTag("Camera")]
void SetUsedCameras(string[] cameraIDs);
[OperationContract]
[WebInvoke]
[SwaggerWcfTag("Debug")]
object[] GetData(string[] ids);
CameraStatus is an enum.
The endpoints are configured like this:
restEndpoint = this.serviceHost.AddServiceEndpoint(typeof(CoreCommunication.Contracts.ICamera), bindingWeb, "Rest/Camera");
restEndpoint.Behaviors.Add(new WebHttpBehavior() { DefaultOutgoingResponseFormat = System.ServiceModel.Web.WebMessageFormat.Json, DefaultBodyStyle = System.ServiceModel.Web.WebMessageBodyStyle.WrappedRequest });
For the first method the response references "#/definitions/Lap.CoreCommunication.Contracts.CameraStatus", but this type is not created.
For the second and third methods the responses are defined as array of "#/definitions/". This type is also missing.
they are all Primitive Type, will be skipped.
The problem seems to be caused by setting the body style and format in WebHttpBehavior.
I have fixed the problem by settings BodyStyle, RequestFormat, and "ResponseFormat" in [WebInvoke] and [WebGet].
ok, when use WebMessageBodyStyle.Wrapped & RequestFormat = WebMessageFormat.Xml, be carefull about the namespace of the datacontract