diff --git a/fern/pages/changelogs/csharp-sdk/2025-03-03.mdx b/fern/pages/changelogs/csharp-sdk/2025-03-03.mdx index f730916fddb..f3f9f63a6f3 100644 --- a/fern/pages/changelogs/csharp-sdk/2025-03-03.mdx +++ b/fern/pages/changelogs/csharp-sdk/2025-03-03.mdx @@ -26,4 +26,7 @@ - Use `base-api-exception-class-name` if configured, - otherwise, fall back to `exported-client-class-name` if configured, with `ApiException` suffix, - otherwise, fall back to `client-class-name` if configured, with `ApiException` suffix, - - otherwise, fall back to the computed client name, with `ApiException` suffix. \ No newline at end of file + - otherwise, fall back to the computed client name, with `ApiException` suffix. + +## 1.12.0-rc9 +**`(fix):`** Fix inline path parameters with pagination endpoints. \ No newline at end of file diff --git a/generators/csharp/sdk/src/endpoint/AbstractEndpointGenerator.ts b/generators/csharp/sdk/src/endpoint/AbstractEndpointGenerator.ts index 7dfbf81e9be..5ee8387b30a 100644 --- a/generators/csharp/sdk/src/endpoint/AbstractEndpointGenerator.ts +++ b/generators/csharp/sdk/src/endpoint/AbstractEndpointGenerator.ts @@ -40,23 +40,11 @@ export abstract class AbstractEndpointGenerator { serviceId: ServiceId; endpoint: HttpEndpoint; }): EndpointSignatureInfo { - const request = getEndpointRequest({ context: this.context, endpoint, serviceId }); - const requestParameter = - request != null - ? csharp.parameter({ type: request.getParameterType(), name: request.getParameterName() }) - : undefined; - const { pathParameters, pathParameterReferences } = this.getAllPathParameters({ + return this.getEndpointSignatureInfoFor({ + serviceId, endpoint, - requestParameter + endpointType: "unpaged" }); - return { - baseParameters: [...pathParameters, requestParameter].filter((p): p is csharp.Parameter => p != null), - pathParameters, - pathParameterReferences, - request, - requestParameter, - returnType: getEndpointReturnType({ context: this.context, endpoint }) - }; } protected getPagerEndpointSignatureInfo({ @@ -66,19 +54,49 @@ export abstract class AbstractEndpointGenerator { serviceId: ServiceId; endpoint: HttpEndpoint; }): EndpointSignatureInfo { - const { pathParameters, pathParameterReferences } = this.getAllPathParameters({ endpoint }); + return this.getEndpointSignatureInfoFor({ + serviceId, + endpoint, + endpointType: "paged" + }); + } + + protected getEndpointSignatureInfoFor({ + serviceId, + endpoint, + endpointType + }: { + serviceId: ServiceId; + endpoint: HttpEndpoint; + endpointType: "unpaged" | "paged"; + }): EndpointSignatureInfo { const request = getEndpointRequest({ context: this.context, endpoint, serviceId }); const requestParameter = request != null ? csharp.parameter({ type: request.getParameterType(), name: request.getParameterName() }) : undefined; + const { pathParameters, pathParameterReferences } = this.getAllPathParameters({ + endpoint, + requestParameter + }); + let returnType: csharp.Type | undefined; + switch (endpointType) { + case "unpaged": + returnType = getEndpointReturnType({ context: this.context, endpoint }); + break; + case "paged": + returnType = this.getPagerReturnType(endpoint); + break; + default: + assertNever(endpointType); + } return { baseParameters: [...pathParameters, requestParameter].filter((p): p is csharp.Parameter => p != null), pathParameters, pathParameterReferences, request, requestParameter, - returnType: this.getPagerReturnType(endpoint) + returnType }; } @@ -129,7 +147,7 @@ export abstract class AbstractEndpointGenerator { requestParameter }: { endpoint: HttpEndpoint; - requestParameter?: csharp.Parameter; + requestParameter: csharp.Parameter | undefined; }): Pick { const pathParameters: csharp.Parameter[] = []; const pathParameterReferences: Record = {}; diff --git a/generators/csharp/sdk/versions.yml b/generators/csharp/sdk/versions.yml index fde44f82fb2..fc4eda58a61 100644 --- a/generators/csharp/sdk/versions.yml +++ b/generators/csharp/sdk/versions.yml @@ -7,6 +7,13 @@ # Set `enable-forward-compatible-enums` to `false` in the configuration to generate the old enums. # irVersion: 53 +- version: 1.12.0-rc9 + createdAt: "2025-03-03" + irVersion: 56 + changelogEntry: + - type: fix + summary: Fix inline path parameters with pagination endpoints. + - version: 1.12.0-rc8 createdAt: "2025-03-03" irVersion: 56