Exemple #1
0
        public virtual string GetType(HttpActionDescriptor actionDescriptor)
        {
            var reflectedActionDescriptor = actionDescriptor as ReflectedHttpActionDescriptor;

            if (reflectedActionDescriptor != null)
            {
                return(SwaggerSpec.GetDataTypeName(reflectedActionDescriptor.MethodInfo.ReturnType));
            }
            return(null);
        }
Exemple #2
0
        /// <summary>
        /// Creates an operation parameter
        /// </summary>
        /// <param name="api">Description of the api via the ApiExplorer</param>
        /// <param name="param">Description of a parameter on an operation via the ApiExplorer</param>
        /// <param name="docProvider">Access to the XML docs written in code</param>
        /// <returns>An operation parameter</returns>
        public static ResourceApiOperationParameter CreateResourceApiOperationParameter(ApiDescription api, ApiParameterDescription param, XmlCommentDocumentationProvider docProvider)
        {
            string paramType = (param.Source.ToString().Equals(FROMURI)) ? QUERY : BODY;
            ResourceApiOperationParameter parameter = new ResourceApiOperationParameter()
            {
                paramType   = (paramType == "query" && api.RelativePath.IndexOf("{" + param.Name + "}") > -1) ? PATH : paramType,
                name        = param.Name,
                description = param.Documentation,
                dataType    = SwaggerSpec.GetDataTypeName(param.ParameterDescriptor.ParameterType),
                required    = docProvider.GetRequired(param.ParameterDescriptor)
            };

            return(parameter);
        }