Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

string[] Parameter, enum Return Value #181

Open
marcobudde opened this issue Oct 5, 2018 · 3 comments
Open

string[] Parameter, enum Return Value #181

marcobudde opened this issue Oct 5, 2018 · 3 comments

Comments

@marcobudde
Copy link

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.

@justin0522
Copy link
Contributor

justin0522 commented Oct 8, 2018

they are all Primitive Type, will be skipped.

@marcobudde
Copy link
Author

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].

@justin0522
Copy link
Contributor

ok, when use WebMessageBodyStyle.Wrapped & RequestFormat = WebMessageFormat.Xml, be carefull about the namespace of the datacontract

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants