diff --git a/src/frontend/src/components/api-reference/GoMemberCard.astro b/src/frontend/src/components/api-reference/GoMemberCard.astro index a731747525..f09c58b10d 100644 --- a/src/frontend/src/components/api-reference/GoMemberCard.astro +++ b/src/frontend/src/components/api-reference/GoMemberCard.astro @@ -90,10 +90,13 @@ const parameters: { name: string; type: string; description?: string | null; isC })) : []; const options = isCallable ? member.options : undefined; +// Variadic options are typed values named , such as HttpEndpointPort. +const optionValuePrefix = member.name.replace(/^With(?=[A-Z])/, ''); +const optionInterfaceName = `Option`; if (options?.typeName) { parameters.push({ name: getGoOptionsParameterName({ signature: member.signature ?? undefined, options }), - type: `...*${options.typeName}`, + type: options.isDirect ? `...*${options.typeName}` : `...${optionInterfaceName}`, description: 'Optional settings, described under Options.', }); } @@ -183,8 +186,9 @@ const errorModelSegments = ) : (

Optional parameters are passed in a trailing{' '} - {getGoOptionsParameterName({ signature: member.signature ?? undefined, options })} ...*{options.typeName}{' '} - argument. + {getGoOptionsParameterName({ signature: member.signature ?? undefined, options })} ...{optionInterfaceName}{' '} + argument as typed option values, such as aspire.{optionValuePrefix}{optionFields[0]?.name ?? 'Option'}(value). The{' '} + *{options.typeName} struct is still accepted for compatibility.

)} {optionFields.length > 0 && ( diff --git a/src/frontend/src/content/docs/app-host/go-apphost-conventions.mdx b/src/frontend/src/content/docs/app-host/go-apphost-conventions.mdx index 98798d978a..8173233a20 100644 --- a/src/frontend/src/content/docs/app-host/go-apphost-conventions.mdx +++ b/src/frontend/src/content/docs/app-host/go-apphost-conventions.mdx @@ -35,6 +35,8 @@ Options are applied from left to right. Omitting an option preserves the default The generated SDK still accepts pointer-based options structs for compatibility. DTO inputs that aren't variadic options, such as `AddContainerOptions`, retain their declared field types. Check the generated SDK for the exact types and option names available for your installed integrations. +Numeric parameters use the Go type that matches the underlying .NET type, such as `int`, `int64`, `float32`, `float64`, or an unsigned type, instead of always using `float64`. Obsolete .NET members aren't generated, unless an active method signature still needs the type. Generated `.go` files are formatted with `gofmt`. + The [`WithHttpEndpoint` API reference](/reference/api/go/aspire.hosting/withhttpendpoint/) describes the available endpoint settings. ## Errors