Skip to content

Commit

Permalink
Remove extraneous lro detection for operations that reurn a Status Mo…
Browse files Browse the repository at this point in the history
…nitor
  • Loading branch information
markcowl committed Sep 24, 2024
1 parent 3c75a9d commit bf75b9f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 6 deletions.
6 changes: 0 additions & 6 deletions packages/typespec-azure-core/src/lro-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,12 +333,6 @@ export function getLroMetadata(program: Program, operation: Operation): LroMetad
return createLroMetadata(program, operation, context);
}

const originalStep = getPollingStep(program, operation, context);
if (originalStep !== undefined) {
context.pollingStep = originalStep;
return createLroMetadata(program, operation, context);
}

return undefined;
}

Expand Down
34 changes: 34 additions & 0 deletions packages/typespec-azure-core/test/operations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2995,6 +2995,40 @@ op createJob(
deepStrictEqual(metadata, undefined);
});

it("Gets Lro undefined for sync operation with status field", async () => {
const [_, metadata] = await compileLroOperation(
`// Reuse CustomParameters and CustomResponseProperties in the "normal" TParams and TResponse fields
model OpParams {
value: string;
...CustomParameters;
};
model OpResponse is CustomResponseProperties {
message: string;
status: "Succeeded" | "Failed" | "Canceled";
}
@test op update is Azure.Core.ResourceAction<TestModel, OpParams, OpResponse>;`
);
deepStrictEqual(metadata, undefined);
});

it("Gets Lro undefined for sync operation with provisioningState field", async () => {
const [_, metadata] = await compileLroOperation(
`// Reuse CustomParameters and CustomResponseProperties in the "normal" TParams and TResponse fields
model OpParams {
value: string;
...CustomParameters;
};
model OpResponse is CustomResponseProperties {
message: string;
provisioningState: "Succeeded" | "Failed" | "Canceled";
}
@test op update is Azure.Core.ResourceAction<TestModel, OpParams, OpResponse>;`
);
deepStrictEqual(metadata, undefined);
});

it("signatures with customizable responses do not accept unions for TResponse", async () => {
const [_, diagnostics] = await getOperations(`
model Foo {}
Expand Down

0 comments on commit bf75b9f

Please sign in to comment.