Table of Contents

Class RefitGenerator

Namespace
Refitter.Core
Assembly
Refitter.Core.dll

Generates Refit clients and interfaces based on an OpenAPI specification.

public class RefitGenerator
Inheritance
RefitGenerator
Inherited Members

Constructors

RefitGenerator(RefitGeneratorSettings, OpenApiDocument)

Generates Refit clients and interfaces based on an OpenAPI specification.

public RefitGenerator(RefitGeneratorSettings settings, OpenApiDocument document)

Parameters

settings RefitGeneratorSettings
document OpenApiDocument

Properties

OpenApiDocument

OpenAPI specifications used to generate Refit clients and interfaces. This is the filtered/cleaned document after pipeline processing.

public OpenApiDocument OpenApiDocument { get; }

Property Value

OpenApiDocument

Methods

CreateAsync(RefitGeneratorSettings, CancellationToken)

Creates a new instance of the RefitGenerator class asynchronously by loading the document from settings, then filtering, and cleaning it.

public static Task<RefitGenerator> CreateAsync(RefitGeneratorSettings settings, CancellationToken cancellationToken = default)

Parameters

settings RefitGeneratorSettings
cancellationToken CancellationToken

Returns

Task<RefitGenerator>

Generate()

Generates Refit clients and interfaces based on an OpenAPI specification and returns the generated code as a string.

public string Generate()

Returns

string

The generated code as a string.

GenerateMultipleFiles()

Generates multiple files containing Refit interfaces and contracts.

public GeneratorOutput GenerateMultipleFiles()

Returns

GeneratorOutput

A GeneratorOutput containing all generated code files.