private JToken LoadDiscoveryFile(string uri, DocumentSourceType type)
        {
            return(JToken.Parse(GetContent(type)));

            string GetContent(DocumentSourceType source)
            {
                switch (source)
                {
                case DocumentSourceType.File:
                    return(File.ReadAllText(uri));

                case DocumentSourceType.Directory:
                    throw new NotSupportedException(
                              $"Discovery may only be used with files and web-resources. '{uri}' is a directory.");

                case DocumentSourceType.Web:
                    var client = ClientFactory.CreateClient();
                    return(client.GetStringAsync(uri).Result);

                case DocumentSourceType.Unknown:
                    throw new Exception("Unable to determine type of URI for discovery file.");

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
        }
        private IOpenApiDocumentProvider GetProvider(DocumentSourceType type, string uri)
        {
            switch (type)
            {
            case DocumentSourceType.File:
                return(new FileOpenApiDocumentProvider(uri));

            case DocumentSourceType.Directory:
                return(new DirectoryOpenApiDocumentsProvider(uri));

            case DocumentSourceType.Web:
                return(new WebOpenApiDocumentProvider(ClientFactory, uri));

            case DocumentSourceType.Unknown:
                throw new Exception("Unable to determine URI type.");

            default:
                throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }
        }