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(); } }
public static string GetDocumentPath(this NSwagClientAttribute attribute, Replacer replacer) { return(replacer.Replace(attribute.DocumentPath)); }
public static uint GetDocumentCacheKey(this NSwagClientAttribute attribute, Replacer replacer) { var path = attribute.GetDocumentPath(replacer); return((uint)attribute.Source.GetHashCode().MergeHash(path.GetHashCode())); }