Skip to content

Commit

Permalink
resolve anonymous model type of lro issue (#4448)
Browse files Browse the repository at this point in the history
- add a workaround to bypass anonymous model type for lro issue
Azure/typespec-azure#1538
  • Loading branch information
chunyu3 authored Sep 18, 2024
1 parent eda2488 commit 2d183a7
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions packages/http-client-csharp/emitter/src/lib/operation-converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import { getExternalDocs, getOperationId } from "./decorators.js";
import { fromSdkHttpExamples } from "./example-converter.js";
import { Logger } from "./logger.js";
import { getInputType } from "./model.js";
import { isSdkPathParameter } from "./utils.js";
import { capitalize, isSdkPathParameter } from "./utils.js";

export function fromSdkServiceMethod(
method: SdkServiceMethod<SdkHttpOperation>,
Expand Down Expand Up @@ -210,7 +210,17 @@ function loadLongRunningOperation(
if (method.kind !== "lro") {
return undefined;
}

/* Remove this workaround when https://github.com/Azure/typespec-azure/issues/1538 is resolved */
if (
method.__raw_lro_metadata.finalEnvelopeResult &&
method.__raw_lro_metadata.finalEnvelopeResult !== "void" &&
method.__raw_lro_metadata.finalEnvelopeResult.name === ""
) {
method.__raw_lro_metadata.finalEnvelopeResult = {
...method.__raw_lro_metadata.finalEnvelopeResult,
name: capitalize(`${method.name}Response`),
};
}
return {
FinalStateVia: convertLroFinalStateVia(method.__raw_lro_metadata.finalStateVia),
FinalResponse: {
Expand Down

0 comments on commit 2d183a7

Please sign in to comment.