Skip to content

Commit 1c7411f

Browse files
committed
Add missing text stream overloads
1 parent 2aea0fd commit 1c7411f

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

src/NSwag.Core.Yaml/OpenApiYamlDocument.cs

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,37 @@ public static async Task<OpenApiDocument> FromYamlAsync(string data, string docu
6464
=> await FromYamlAsync(new StringReader(data), documentPath, expectedSchemaType, referenceResolverFactory,
6565
cancellationToken);
6666

67-
/// <summary>Creates a Swagger specification from a YAML string.</summary>
67+
/// <summary>Creates a Swagger specification from a YAML text stream.</summary>
68+
/// <param name="data">The JSON or YAML data.</param>
69+
/// <param name="cancellationToken">The cancellation token.</param>
70+
/// <returns>The <see cref="OpenApiDocument"/>.</returns>
71+
public static Task<OpenApiDocument> FromYamlAsync(TextReader data, CancellationToken cancellationToken = default)
72+
{
73+
return FromYamlAsync(data, null, SchemaType.Swagger2, null, cancellationToken);
74+
}
75+
76+
/// <summary>Creates a Swagger specification from a YAML text stream.</summary>
77+
/// <param name="data">The JSON or YAML data.</param>
78+
/// <param name="documentPath">The document path (URL or file path) for resolving relative document references.</param>
79+
/// <param name="cancellationToken">The cancellation token.</param>
80+
/// <returns>The <see cref="OpenApiDocument"/>.</returns>
81+
public static Task<OpenApiDocument> FromYamlAsync(TextReader data, string documentPath, CancellationToken cancellationToken = default)
82+
{
83+
return FromYamlAsync(data, documentPath, SchemaType.Swagger2, null, cancellationToken);
84+
}
85+
86+
/// <summary>Creates a Swagger specification from a YAML text stream.</summary>
87+
/// <param name="data">The JSON or YAML data.</param>
88+
/// <param name="documentPath">The document path (URL or file path) for resolving relative document references.</param>
89+
/// <param name="expectedSchemaType">The expected schema type which is used when the type cannot be determined.</param>
90+
/// <param name="cancellationToken">The cancellation token.</param>
91+
/// <returns>The <see cref="OpenApiDocument"/>.</returns>
92+
public static Task<OpenApiDocument> FromYamlAsync(TextReader data, string documentPath, SchemaType expectedSchemaType, CancellationToken cancellationToken = default)
93+
{
94+
return FromYamlAsync(data, documentPath, expectedSchemaType, null, cancellationToken);
95+
}
96+
97+
/// <summary>Creates a Swagger specification from a YAML text stream.</summary>
6898
/// <param name="data">The JSON or YAML data as a reader.</param>
6999
/// <param name="documentPath">The document path (URL or file path) for resolving relative document references.</param>
70100
/// <param name="expectedSchemaType">The expected schema type which is used when the type cannot be determined.</param>

0 commit comments

Comments
 (0)