Example #1
0
        /// <summary>
        /// Creates an operation parameter
        /// </summary>
        /// <param name="param">Description of a parameter on an operation via the ApiExplorer</param>
        /// <returns>An operation parameter</returns>
        public Parameter CreateParameter(ApiParameterDescription param)
        {
            var returnType = param.ParameterDescriptor.ParameterType.GetSwaggerType();

            return(new Parameter()
            {
                ParamTypeEnum = param.GetParamType(),
                Name = param.Name,
                Description = param.Documentation,
                Type = returnType.Type,
                Format = returnType.Format,
                Enum = returnType.Enum,
                Required = !param.ParameterDescriptor.IsOptional,
                Items = param.ParameterDescriptor.ParameterType.IsIEnumerable() ? new Items {
                    Type = "string"
                } : null
            });
        }