Exemplo n.º 1
0
        /// <summary>Deserializes a JSON string to a <see cref="JsonSchema" />.</summary>
        /// <param name="data">The JSON string.</param>
        /// <returns>The JSON Schema.</returns>
        public static async Task <JsonSchema> FromYamlAsync(string data)
        {
            var factory = JsonAndYamlReferenceResolver.CreateJsonAndYamlReferenceResolverFactory(new DefaultTypeNameGenerator());

            return(await JsonSchemaYaml.FromYamlAsync(data, null, factory).ConfigureAwait(false));
        }
 /// <summary>Resolves an URL reference.</summary>
 /// <param name="url">The URL.</param>
 /// <exception cref="NotSupportedException">The HttpClient.GetAsync API is not available on this platform.</exception>
 public override async Task <IJsonReference> ResolveUrlReferenceAsync(string url, CancellationToken cancellationToken = default)
 {
     return(await JsonSchemaYaml.FromUrlAsync(url, schema => this, cancellationToken).ConfigureAwait(false));
 }
 /// <summary>Resolves an URL reference.</summary>
 /// <param name="url">The URL.</param>
 /// <exception cref="NotSupportedException">The HttpClient.GetAsync API is not available on this platform.</exception>
 public override async Task <IJsonReference> ResolveUrlReferenceAsync(string url)
 {
     return(await JsonSchemaYaml.FromUrlAsync(url, schema => this).ConfigureAwait(false));
 }
 /// <summary>Resolves a file reference.</summary>
 /// <param name="filePath">The file path.</param>
 /// <returns>The resolved JSON Schema.</returns>
 /// <exception cref="NotSupportedException">The System.IO.File API is not available on this platform.</exception>
 public override async Task <IJsonReference> ResolveFileReferenceAsync(string filePath, CancellationToken cancellationToken = default)
 {
     return(await JsonSchemaYaml.FromFileAsync(filePath, schema => this, cancellationToken).ConfigureAwait(false));
 }
 /// <summary>Resolves a file reference.</summary>
 /// <param name="filePath">The file path.</param>
 /// <returns>The resolved JSON Schema.</returns>
 /// <exception cref="NotSupportedException">The System.IO.File API is not available on this platform.</exception>
 public override async Task <IJsonReference> ResolveFileReferenceAsync(string filePath)
 {
     return(await JsonSchemaYaml.FromFileAsync(filePath, schema => this).ConfigureAwait(false));
 }