示例#1
0
        public static string GetDocument(this NSwagClientAttribute attribute, Replacer replacer)
        {
            var path = attribute.GetDocumentPath(replacer);

            switch (attribute.Source)
            {
            case DocumentSource.Local:
                if (!File.Exists(path))
                {
                    throw new FileNotFoundException("Swagger document not found", path);
                }
                return(File.ReadAllText(path));

            case DocumentSource.Remote:
                return(DynamicApis.HttpGetAsync(path).Result);

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
示例#2
0
 public static string GetDocumentPath(this NSwagClientAttribute attribute, Replacer replacer)
 {
     return(replacer.Replace(attribute.DocumentPath));
 }
示例#3
0
        public static uint GetDocumentCacheKey(this NSwagClientAttribute attribute, Replacer replacer)
        {
            var path = attribute.GetDocumentPath(replacer);

            return((uint)attribute.Source.GetHashCode().MergeHash(path.GetHashCode()));
        }