AutoRestRunner.

Generate(FilePath, Action<AutoRestSettings>) Method

Summary

Invokes AutoRest to create a client model for the provided API spec, optionally using the provided settings.
Assembly
Cake.AutoRest.dll
Namespace
Cake.AutoRest
Containing Type
AutoRestRunner

Syntax

public DirectoryPath Generate(FilePath inputFile, Action<AutoRestSettings> configure = null)

Examples

Run with all the defaults:

Task("Use-Defaults")
    .Does(() => {
        AutoRest.Generate("./sample.json");
});

Configure using fluent interface (equivalent to above)

Task("Fluent-Interface")
.Does(() => {
    AutoRest.Generate("./sample.json", settings =>
        settings.UseNamespace("Cake")
            .UseClientName("Cake.AutoRest")
            .AddHeaderComment("Generated by Cake.AutoRest")
            .WithGenerator(CodeGenerator.AzureCSharp)
            .OutputToDirectory("./dist/client"));
});

Parameters

Name Type Description
inputFile FilePath Local API specification file (e.g. swagger definition)
configure Action<AutoRestSettings> Optional action to configure runner settings

Return Value

Type Description
DirectoryPath The directory where the client was generated