Class OpenApiDocumentFactory
Creates instances of NSwag.OpenApiDocument from file paths or URLs. Supports loading single documents or merging multiple documents into one.
public static class OpenApiDocumentFactory
- Inheritance
-
OpenApiDocumentFactory
- Inherited Members
Methods
CreateAsync(IEnumerable<string>, CancellationToken)
Creates a merged NSwag.OpenApiDocument from multiple paths or URLs. The first document serves as the base; paths and schemas from subsequent documents are merged in.
public static Task<OpenApiDocument> CreateAsync(IEnumerable<string> openApiPaths, CancellationToken cancellationToken = default)
Parameters
openApiPathsIEnumerable<string>The paths or URLs to the OpenAPI specifications.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<OpenApiDocument>
A merged NSwag.OpenApiDocument.
Exceptions
- ArgumentNullException
Thrown when
openApiPathsis null.- ArgumentException
Thrown when
openApiPathsis empty.
CreateAsync(string, CancellationToken)
Creates a new instance of the NSwag.OpenApiDocument class asynchronously.
public static Task<OpenApiDocument> CreateAsync(string openApiPath, CancellationToken cancellationToken = default)
Parameters
openApiPathstringThe path or URL to the OpenAPI specification.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<OpenApiDocument>
A new instance of the NSwag.OpenApiDocument class.