Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic response for lro delete operation in typespec-aaz #435

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/typespec-aaz/src/convertor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,22 @@ function extractHttpResponses(context: AAZOperationEmitterContext, operation: Ht
if (success204Response !== undefined) {
responses.push(success204Response);
}

const success_status_code: number[] = [
...success2xxResponse?.statusCode || [],
...success202Response?.statusCode || [],
...success204Response?.statusCode || [],
]
const lro_base_status_code = success_status_code.filter(code => [200, 201].includes(code))
if (lro_base_status_code.length === 0 && lroMetadata !== undefined && operation.verb === "delete"){
const lro_response: CMDHttpResponse = {
statusCode: [200, 201],
isError: false,
description: "Response schema for long-running operation."
};
Comment on lines +395 to +399
Copy link
Collaborator

@kairu-ms kairu-ms Dec 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the schema of LRO for delete of 200 and 201 response? You can verify what 200 and 201 responses are used in LRO based on azure rest api guideline

responses.push(lro_response)
}

if (redirectResponse !== undefined) {
responses.push(redirectResponse);
}
Expand Down
Loading