Azure / typespec-azure

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

getAllHttpServices should not return a service when none is defined in the tsp #1018

Closed JoshLove-msft closed 2 months ago

JoshLove-msft commented 3 months ago

Even after removing the service tag in https://github.com/Azure/azure-rest-api-specs/blob/main/specification/eventgrid/Azure.Messaging.EventGrid.SystemEvents/main.tsp, a SystemEventsClient is generated. This is not correct as this is a models-only package. Additionally, to work around the error about there not being any routes defined, we needed to relax this to a warning in https://github.com/Azure/autorest.csharp/pull/4814. Once this issue is fixed, the change in https://github.com/Azure/autorest.csharp/pull/4814 can be reverted.

markcowl commented 3 months ago

@JoshLove-msft Is this about the emitter processing or about what the typespec api is returning?

allenjzhang commented 3 months ago

There is a upcoming design proposal for getServices for different protocols. The current implementation is old and quite involved. The proposal is to work around in emitter for now.

markcowl commented 2 months ago

@witemple-msft Please close in favor of comprehensive issue

witemple-msft commented 2 months ago

@JoshLove-msft there is a more encompassing issue here about specifying the protocol of the service, and I expect that a design for that issue will address this as well. i agree that this is a somewhat unexpected implied behavior, but it is also very helpful for the playground to be able to just write an operation and see an output without setting up the artifice of a service.

In addressing the other issue I'd like to explore a configuration option that the playground and emitters could use to decide whether or not the root namespace should be considered an implied service rather than this behavior where we do it by default.

https://github.com/microsoft/typespec/issues/3523