private JsonSchema4 ResolveFileReference(string url, string jsonPath) { if (DynamicApis.SupportsFileApis) { try { var arr = Regex.Split(url, @"(?=#)"); if (!_resolvedSchemas.ContainsKey(arr[0])) { JsonSchema4.FromFile(arr[0], this); } var result = _resolvedSchemas[arr[0]]; return(arr.Length == 1 ? result : ResolveReference(result, arr[1])); } catch (Exception exception) { throw new InvalidOperationException("Could not resolve the path '" + jsonPath + "' with the file path '" + url + "': " + exception.Message, exception); } } else { throw new NotSupportedException("Could not resolve the path '" + jsonPath + "' because JSON file references are not supported on this platform."); } }
/// <summary>Resolves a file reference.</summary> /// <param name="filePath">The file path.</param> /// <returns>The resolved JSON Schema.</returns> /// <exception cref="System.NotSupportedException">Could not resolve the JSON path because file references are not supported on this platform.</exception> protected virtual JsonSchema4 ResolveFileReference(string filePath) { if (DynamicApis.SupportsFileApis) { return(JsonSchema4.FromFile(filePath, this)); } else { throw new NotSupportedException("Could not resolve the JSON path because file references are not supported on this platform."); } }