Skip to content

CLI

C# configuration options

This section details the available configuration options for the C# SDK. All configuration is managed in the gen.yaml file under the csharp section.

csharp:
version: 1.2.3
author: "Author Name"
packageName: "custom-sdk"
dotnetVersion: "net10.0"
description: "A description of your SDK"
Name
version
Required
true
Description
The current version of the SDK.
Default Value
0.0.1
packageName
Required
true
Description
The NuGet package ID, also used as the root namespace
Default Value
openapi
author
Required
true
Description
The name of the author of the published package.
Default Value
Speakeasy
dotnetVersion
Required
false
Description
The version of .NET to target. Supported versions: net5.0, net6.0, net8.0, and net10.0 (default).
Default Value
net10.0
description
Required
false
Description
A description of the SDK that will be included in the generated .csproj file.
Default Value
Uses the OpenAPI spec's description or summary field
csharp:
packageTags: "openapi sdk rest"
includeDebugSymbols: true
enableSourceLink: true
Name
packageTags
Required
false
Description
Space-delimited list of tags and keywords used when searching for packages on NuGet.
Default Value
""
includeDebugSymbols
Required
false
Description
Whether to generate .pdb files and publish a .snupkg symbol package to NuGet.
Default Value
false
enableSourceLink
Required
false
Description
Whether to produce and publish the package with Source Link. See Source Link.
Default Value
false
csharp:
additionalDependencies:
- package: Newtonsoft.Json
version: 13.0.3
Name
additionalDependencies
Required
false
Description
Add additional dependencies to include in the generated .csproj file. Dependencies must be specified as objects with package and version properties.
Default Value
[]
csharp:
maxMethodParams: 4
enableCancellationToken: true
Name
Required
false
Description
Maximum number of parameters before an input object is created. 0 means input objects are always used.
Default Value
4
enableCancellationToken
Required
false
Description
Enables cancellation token support in async methods and hooks.
Default Value
true
csharp:
flattenGlobalSecurity: true
Property
Description
Enables inline security credentials during SDK instantiation. Recommended: true
Default
true
Type
boolean
csharp:
sourceDirectory: "src"
disableNamespacePascalCasingApr2024: false
Name
sourceDirectory
Required
false
Description
The name of the source directory.
Default Value
src
disableNamespacePascalCasingApr2024
Required
false
Description
Whether to disable Pascal Casing sanitization on the packageName when setting the root namespace and NuGet package ID.
Default Value
false
csharp:
imports:
option: "openapi"
paths:
callbacks: models/callbacks
errors: models/errors
operations: models/operations
shared: models/components
webhooks: models/webhooks
Field
option
Required
false
Description
Defines the type of import strategy. Typically set to "openapi", indicating that the structure is based on the OpenAPI document.
Default Value
"openapi"
paths
Required
false
Description
Customizes where different parts of the SDK (e.g., callbacks, errors, and operations) will be imported from.
Default Value
{}
Component
callbacks
Default Value
models/callbacks
Description
The directory where callback models will be imported from.
errors
Default Value
models/errors
Description
The directory where error models will be imported from.
operations
Default Value
models/operations
Description
The directory where operation models (i.e., API endpoints) will be imported from.
shared
Default Value
models/components
Description
The directory for shared components, such as reusable schemas, and data models, imported from the OpenAPI spec.
webhooks
Default Value
models/webhooks
Description
The directory for webhook models, if the SDK includes support for webhooks.
csharp:
clientServerStatusCodesAsErrors: true
responseFormat: "envelope-http"
Name
Required
false
Description
Defines how responses are structured. Options: envelope, envelope-http, or flat.
Default Value
envelope-http
clientServerStatusCodesAsErrors
Required
false
Description
Treats 4XX and 5XX status codes as errors. Set to false to treat them as normal responses.
Default Value
true