Open
Description
Tracking list of bugs found while trying to performance test a library generated with annotation processor:
Variable name conflict when creating theHttpRequest.uri
if there is a method parameter with the nameurl
.String url
is hardcoded as the variable name to use, ran across a case in Storage where the Swagger/TypeSpec defines a method parameter with nameurl
which resulted inString url = url + ...
.Handling of adding HTTP headers toHttpRequest
will add them even if the value isnull
. InSwaggerMethodParser
inazure-core
null valued headers were excluded from being added. Worse, the null value will be stringified as "null", which makes any temporary fixes for cleaning more difficult as "null" could be a legitimate value.When the network response status code doesn't match what's expected a very basic exception is thrown that loses all information provided by the error response. It is simplythrow new RuntimeException("Unexpected response code: " + responseCode);
, which isn't enough information to troubleshoot. Returning a proper exception needs to be done.Storage Blob download has re-introduced a previous bug whereContent-Type
is being inspected before returning the download body, where Storage Blob allows providing metadata about the blob such as a JSON file beingContent-Type: application/json
. We want to explicitly ignore that for Storage Blob, and other APIs that may provide the same functionality, as we don't know how to handle the payload and should be returning a generic stream of bytes for the caller to manage converting to more specific data formats.Methods with headers callHttpHeaderName.fromString
each time when the header name isn't a constant. Annotation processing should be updated to collect allHttpHeaderName.fromString
calls and convert those into statics on the service interface implementation. Possibly a common constants file shared across all generated interfaces as many services use the same headers in multiple service interfaces.- URI creation should use
UriBuilder
and remove the need for handling query parameters in aLinkedHashMap
when collecting them to be handled. - Service interface implementations generate with
JsonSerializer
andXmlSerializer
class level fields even when they aren't used. And aClientLogger
static variable as well. Those should be added at the end of code generation after we know they'll be used.