public object GetMetadata(INancyModule module, RouteDescription routeDescription)
        {
            var entryAssembly = Assembly.GetEntryAssembly();

            if (module.GetType().Assembly != entryAssembly)
            {
                return(null);
            }

            DocumentationObject val = null;
            var    eps = BuildDocumentation(Types);
            string path;
            var    basePath = "/";

            if (module.ModulePath.Length > 1)
            {
                basePath = module.ModulePath;
                path     = routeDescription.Path.Replace(module.ModulePath, "");
                if (string.IsNullOrEmpty(path))
                {
                    path = "/";
                }
            }
            else
            {
                path = routeDescription.Path;
            }
            val = eps.FirstOrDefault(p => string.Equals(routeDescription.Method, p.HttpMethod.ToString(), StringComparison.CurrentCultureIgnoreCase) && p.BasePath == basePath && path == p.Path);
            if (val == null)
            {
                //TODO:(drose) throw exception to enfore usage?
                Console.ForegroundColor = ConsoleColor.Red;
                Console.Out.WriteLine($"No Documentation Found For {module.GetModuleName()}Module : {routeDescription.Method} {path}");
                Console.ForegroundColor = ConsoleColor.White;
                return(null);
            }
            val.BasePath   = basePath;
            val.ModuleName = module.GetModuleName().ToLower();

            return(val);
        }
        private List <DocumentationObject> BuildDocumentation(List <Type> moduleInterfaces)
        {
            var endpointDocs = new List <DocumentationObject>();

            foreach (var moduleInterface in moduleInterfaces)
            {
                var descriptor      = (DocumentationDescriptorAttribute)moduleInterface.GetCustomAttributes().First(a => a.GetType() == typeof(DocumentationDescriptorAttribute));
                var declaredMethods = moduleInterface.GetMethods();
                foreach (var method in declaredMethods)
                {
                    var doc = new DocumentationObject();
                    doc.BasePath = descriptor.BasePath;
                    var descriptionAttribute =
                        method.GetCustomAttributes().FirstOrDefault(p => p.GetType() == typeof(RouteDescriptorAttribute)) as RouteDescriptorAttribute;
                    if (descriptionAttribute == null)
                    {
                        throw new Exception("All methods declared on the interface must have a description attribute");
                    }
                    doc.Path        = descriptionAttribute.Path;
                    doc.HttpMethod  = descriptionAttribute.HttpMethodType.ToString();
                    doc.Description = descriptionAttribute.Description;
                    var responseType = method.ReturnType;
                    doc.ResponseModel = GenerateObjectDictionary(responseType);
                    var parameters = method.GetParameters();
                    if (parameters.Length != 0)
                    {
                        if (parameters.Length > 1)
                        {
                            throw new Exception("interface for module should have one arg (view model) or 0");
                        }
                        var requestParam = parameters.First();
                        var requestType  = requestParam.ParameterType;
                        doc.RequestModel = GenerateObjectDictionary(requestType);
                    }
                    endpointDocs.Add(doc);
                }
            }
            return(endpointDocs);
        }