Table of Contents

Class OpenApiDocumentFactory

Namespace
Refitter.Core
Assembly
Refitter.Core.dll

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

openApiPaths IEnumerable<string>

The paths or URLs to the OpenAPI specifications.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<OpenApiDocument>

A merged NSwag.OpenApiDocument.

Exceptions

ArgumentNullException

Thrown when openApiPaths is null.

ArgumentException

Thrown when openApiPaths is 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

openApiPath string

The path or URL to the OpenAPI specification.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<OpenApiDocument>

A new instance of the NSwag.OpenApiDocument class.