Skip to content
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

tsp, support TCGC added endpoint together with user defined endpoint for one client #2912

Open
Tracked by #2931
haolingdong-msft opened this issue Aug 13, 2024 · 2 comments
Assignees

Comments

@haolingdong-msft
Copy link
Member

haolingdong-msft commented Aug 13, 2024

Linik #2861 (comment)

Now for below TSP definition, TCGC will add an client endpoint with server url set to {endpoint} which means the endpoint is overridable. But currently we did a workaroud for this case to just remove the TCGC added {endpoint}. So it is not overridable. We should support in generated SDK to make it overridable.

@server(
  "http://{region}.azure.net", "",
  {
    region: string;
  }
)

More detailed design will be added later.

A more complex case can be below:
There could be multiple @server to define different endpoint url. tsp definition is like below:

@server(
  "{endpoint}/widget",
  "Contoso Widget APIs",
  {
    /** 
Supported Widget Services endpoints (protocol and hostname, for example:
https://westus.api.widget.contoso.com).
 */
    endpoint: string,
  }
)
@server(
  "http://localhost:3000", "test endpoint"
)
@service({})
namespace My.Service;

Multiple server url defined for one client. This may need a seperate issue.

@haolingdong-msft haolingdong-msft self-assigned this Aug 13, 2024
@haolingdong-msft haolingdong-msft changed the title Support multiple server url defined for one client tsp, support multiple server url defined for one client Aug 13, 2024
@weidongxu-microsoft
Copy link
Member

weidongxu-microsoft commented Aug 13, 2024

I guess in short term the priority would be the simple single server case in TypeSpec (but TCGC adds the endpoint), e.g.

@server(
  "http://{region}.azure.net", "",
  {
    region: string;
  }
)

Full support for multiple server in TypeSpec be a more complicated problem.

@haolingdong-msft haolingdong-msft changed the title tsp, support multiple server url defined for one client tsp, support TCGC added endpoint together with user defined endpoint for one client Aug 14, 2024
@haolingdong-msft
Copy link
Member Author

I guess in short term the priority would be the simple single server case in TypeSpec (but TCGC adds the endpoint), e.g.

@server(
  "http://{region}.azure.net", "",
  {
    region: string;
  }
)

Full support for multiple server in TypeSpec be a more complicated problem.

Update the issue description. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants