Skip to content

add support for @clientOption("includeRootSlash") #9933

@jorgerangel-msft

Description

@jorgerangel-msft

Some legacy services require routes to not be prefixed with the / character. In example an operation with @route("?restype=container") should yield the following request uri: https://myuri/test-container-d1401e73-0567-7e68-91e8-2105f4d5001b?restype=container instead of https://myuri/test-container-d1401e73-0567-7e68-91e8-2105f4d5001b/?restype=container. The / is added by default by typespec to all routes.

We should add a new clientOption to override this behavior. When enabled, it will strip the / character from any prefixed path string.

Example usage on a client:

@@clientOption(Storage.Blob, "includeRootSlash", false, "csharp");

Example usage on an operation:

@@clientOption(Storage.Blob.foo, "includeRootSlash", false, "csharp");

Support for this option should be added for clients, sub-clients / interfaces, and operations. Sub-clients + operations should be able to override the option set by their parent.

Metadata

Metadata

Labels

emitter:client:csharpIssue for the C# client emitter: @typespec/http-client-csharp

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions