We're migrating App Configuration services to typespec and we're running into issues with query parameters
Issues
| Raw emitter output without workarounds |
Expected URL |
/kv/sortQueryParams19?%2524select=key&api-version=2023-11-01&label=dev |
/kv/sortQueryParams19?$select=key&api-version=2023-11-01&label=dev |
/kv?api-version=2023-11-01&key=%2A&label=dev&tags=tag2%3Dvalue2 |
/kv?api-version=2023-11-01&key=*&label=dev&tags=tag2%3Dvalue2 |
$Select is double-encoded.
In models.tsp, we have the query parameters defined here as $Select. In the generation, the emitter writes the parameter name $Select literally into the URI template in operations.ts. Then this is passed into expandUrlTemplate and gets encoded the second time, so it becomes %2524Select. The workaround for this is to manually modify the generated operations.ts file back to $Select.
Expected behavior: the URL request should contain $Select=...
* is encoded by default & tags=tag3=value3 is not encoded if skipUrlEncoding is set
App Configuration allows wildcard filter *, so we can set key=*. When passing through expandUrlTemplate, it is now encoded to key=%2A.
We found out we can set skipUrlEncoding to ensure * is not encoded, but then tags3=value3 will no longer be encoded correctly
Expected behavior: the URL request should contain key=* & tags=tag2=value2
For more context:
tsp-location.yaml
directory: specification/appconfiguration/data-plane/AppConfiguration
commit: 4ec78287ae650c72e27c67ae8126f9d58a8254b5
repo: Azure/azure-rest-api-specs
We're migrating App Configuration services to typespec and we're running into issues with query parameters
Issues
/kv/sortQueryParams19?%2524select=key&api-version=2023-11-01&label=dev/kv/sortQueryParams19?$select=key&api-version=2023-11-01&label=dev/kv?api-version=2023-11-01&key=%2A&label=dev&tags=tag2%3Dvalue2/kv?api-version=2023-11-01&key=*&label=dev&tags=tag2%3Dvalue2$Selectis double-encoded.In
models.tsp, we have the query parameters defined here as$Select. In the generation, the emitter writes the parameter name$Selectliterally into the URI template in operations.ts. Then this is passed intoexpandUrlTemplateand gets encoded the second time, so it becomes%2524Select. The workaround for this is to manually modify the generatedoperations.tsfile back to$Select.Expected behavior: the URL request should contain
$Select=...*is encoded by default &tags=tag3=value3is not encoded ifskipUrlEncodingis setApp Configuration allows wildcard filter
*, so we can setkey=*. When passing throughexpandUrlTemplate, it is now encoded tokey=%2A.We found out we can set
skipUrlEncodingto ensure*is not encoded, but thentags3=value3will no longer be encoded correctlyExpected behavior: the URL request should contain
key=*&tags=tag2=value2For more context:
tsp-location.yaml