Azure / typespec-azure

About TypeSpec Azure Libraries
https://azure.github.io/typespec-azure/
MIT License
15 stars 41 forks source link

[TCGC][Question]: should we provide endpoint SdkEndpointParameter for constant host #1498

Closed qiaozha closed 1 month ago

qiaozha commented 2 months ago

Describe the bug

@server("https://api.openai.com/v1", "OpenAI Endpoint")

in this case, the endpoint is a constant, should we allow customers to modify it, if yes, should we have a required endpoint parameter in the client side ?

Currently, tcgc still returns the required endpoint parameter to us, and because of https://github.com/Azure/typespec-azure/issues/1496#issuecomment-2335108995 we have to set it as a required endpoint parameter. which doesn't quite make sense to me.

Reproduction

n/a

Checklist

tadelesh commented 1 month ago

currently, tcgc return the endpoint parameter as required, and the endpoint parameter type has one template argument of {endpoint} which is required but with a client default value of https://api.openai.com/v1. @iscai-msft do you think we should mark this template argument with optional?

iscai-msft commented 1 month ago

required or optional means whether it's required or optional on the server side. While we don't like required params with client default values, I think this is ultimately a required input with a client default value. Thoughts?

qiaozha commented 1 month ago

I am fine to keep the current way "a required input with a client default value" this also aligns with our current implementation where we ignore the client default value except those defined in the server decorators.

qiaozha commented 1 month ago

I think we can close this issue.