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
csharp:
version: 1.2.3
author: "Author Name"
packageName: "custom-sdk"
dotnetVersion: "net8.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. net8.0 (default), net6.0 and net5.0 supported.
Default Value
dotnetVersion
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
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
files and publish a
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
csharp:
additionalDependencies:
- package: Newtonsoft.Json
version: 13.0.3Name
additionalDependencies
Required
false
Description
Add additional dependencies to include in the generated
file. Dependencies must be specified as objects with package and version properties.
Default Value
[]
Method and parameter management
csharp:
maxMethodParams: 4
enableCancellationToken: trueName
Required
false
Description
Maximum number of parameters before an input object is created.
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
csharp:
flattenGlobalSecurity: trueProperty
Description
Enables inline security credentials during SDK instantiation. Recommended:
Default
true
Type
boolean
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
when setting the root namespace and NuGet package ID.
Default Value
false
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
, 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
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
csharp:
clientServerStatusCodesAsErrors: true
responseFormat: "envelope-http"Name
Required
false
Description
Defines how responses are structured. Options:
,
, or
.
Default Value
envelope-http
clientServerStatusCodesAsErrors
Required
false
Description
Treats
and
status codes as errors. Set to
to treat them as normal responses.
Default Value
true
Last updated on