-
Notifications
You must be signed in to change notification settings - Fork 166
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
Missing cancellation token for Get methods when generating SDK #3330
Comments
Thanks @ArcturusZhang for the suggestion, I've suppressed AZC0002 and no build error reported now. |
Hi @mengaims. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text “ |
@ArcturusZhang please open / link an issue in azure-sdk-tools to address updating the analyzer. |
@m-nash I think we haven't decided how to resolve the ambiguity between convenience and protocol. So we might put off updating the analyzer till we have a decision. |
We have decided. We will always use overloads which means for protocol we will have all required parameters when an ambiguous call exists i.e. there is no RequestContent or it is optional. When there is a RequestContent we can leave the optional parameters optional. We are not moving the location of RequestContext param public Response<Model> Method(string pathParam, CancellationToken token = default)
//protocol must be all required
public Response Method(string pathParam, RequestContext context) when there is a request content we don't need to make all params required public Response<Model> Method(string pathParam, InputModel content, CancellationToken token = default)
//protocol doesn't need to be all required
public Response Method(string pathParam, RequestContent content, RequestContext context = default) Optional body param public Response<Model> Method(string pathParam, InputModel content = null, CancellationToken token = default)
//protocol must be all required
public Response Method(string pathParam, RequestContent content, RequestContext context) |
Close this as the analyzer update is tracked at Azure/azure-sdk-tools#6145 |
Generated code example:
public virtual async Task GetTextBlocklistAsync(string blocklistName, RequestContext context)
The build error example:
SDK PR
TypeSpec PR
The text was updated successfully, but these errors were encountered: