Microsoft Fabric's API guidelines require the API version to be a path parameter rather than a query parameter. We would like to use this tool for generating our TypeScript SDK from our TypeSpec definition but incorporating the API version as a path parameter cannot be accomplished as cleanly as we would like, at least from what we know of the tool. There are two things we would like to be able to do.
First, we would like to set the API version as part of the client creation or route definition rather than having to specify the API version as a parameter in every request. It seems like this is already a feature in the autorest.python project.
Second, we would like api-version to not be automatically added as a query parameter to all requests. I believe there is already an issue that has been created related to this along with a pull request to resolve it.
Are there already features to support this use case that we are simply not aware of? If not, would it be possible to add this as a feature?
Here is a quick example of what our TypeSpec looks like.
model ApiVersionPathParameter {
apiVersion: string;
}
@resource("exampleResources")
model ExampleResource {
@Key
id: string;
}
@tag("ExampleResources")
interface ExampleResourceInterface {
@autoRoute
@readsResource(ExampleResource)
get(
...ApiVersionPathParameter
...Resource.ResourceParameters<ExampleResource>
): ExampleResource;
}
The generated clientDefinition.ts file would then have a Routes interface like the following.
export interface Routes {
(
path: "/{apiVersion}/exampleResources/{id}",
apiVersion: string,
id: string
): ExampleResourcesGet;
Is there a way to either set the path to "/v1/exampleResource/{id}" with no apiVersion parameter or set the client's baseUrl to include the api version at the end and then have all paths look like "/exampleResource/{id}"?
Microsoft Fabric's API guidelines require the API version to be a path parameter rather than a query parameter. We would like to use this tool for generating our TypeScript SDK from our TypeSpec definition but incorporating the API version as a path parameter cannot be accomplished as cleanly as we would like, at least from what we know of the tool. There are two things we would like to be able to do.
First, we would like to set the API version as part of the client creation or route definition rather than having to specify the API version as a parameter in every request. It seems like this is already a feature in the autorest.python project.
Second, we would like
api-versionto not be automatically added as a query parameter to all requests. I believe there is already an issue that has been created related to this along with a pull request to resolve it.Are there already features to support this use case that we are simply not aware of? If not, would it be possible to add this as a feature?
Here is a quick example of what our TypeSpec looks like.
The generated
clientDefinition.tsfile would then have a Routes interface like the following.Is there a way to either set the path to
"/v1/exampleResource/{id}"with noapiVersionparameter or set the client'sbaseUrlto include the api version at the end and then have all paths look like"/exampleResource/{id}"?