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.
Version and general configuration
Section titled “Version and general configuration”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
Publishing configuration
Section titled “Publishing configuration”csharp: packageTags: "openapi sdk rest" includeDebugSymbols: true enableSourceLink: trueName
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
Additional dependencies
Section titled “Additional dependencies”csharp: additionalDependencies: - package: Newtonsoft.Json version: 13.0.3Name
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
[]
Method and parameter management
Section titled “Method and parameter management”csharp: maxMethodParams: 4 enableCancellationToken: trueName
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
Security configuration
Section titled “Security configuration”csharp: flattenGlobalSecurity: trueProperty
Description
Enables inline security credentials during SDK instantiation. Recommended:
trueDefault
true
Type
boolean
Module management
Section titled “Module management”csharp: sourceDirectory: "src" disableNamespacePascalCasingApr2024: falseName
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
Import management
Section titled “Import management”csharp: imports: option: "openapi" paths: callbacks: models/callbacks errors: models/errors operations: models/operations shared: models/components webhooks: models/webhooksField
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
{}
Import paths
Section titled “Import paths”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.
Error and response handling
Section titled “Error and response handling”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