private static Parameter CreateParameter(ApiParameterDescription paramDesc, bool inPath, SchemaRegistry schemaRegistry, IEdmModel edmModel)
        {
            Contract.Requires(paramDesc != null);
            Contract.Requires(schemaRegistry != null);
            Contract.Assume(paramDesc.ParameterDescriptor != null);

            var @in = inPath
                ? "path"
                : paramDesc.Source == ApiParameterSource.FromUri ? "query" : "body";

            var parameter = new Parameter
            {
                name     = paramDesc.Name,
                @in      = @in,
                required = inPath || !paramDesc.ParameterDescriptor.IsOptional,
                @default = paramDesc.ParameterDescriptor.DefaultValue
            };

            var schema = schemaRegistry.GetOrRegisterParameterType(edmModel, paramDesc.ParameterDescriptor);

            if (parameter.@in == "body")
            {
                parameter.schema = schema;
            }
            else
            {
                parameter.PopulateFrom(schema);
            }

            return(parameter);
        }