Azure / typespec-azure

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

[TCGC] Will TCGC support multiple services in one tsp #830

Open chunyu3 opened 4 months ago

chunyu3 commented 4 months ago

Current, tcgc emit a type with one sdkPackage which present one service (api-versions, authentication, clients) image

When there are multiple-services in one tsp (see following example), tcgc will only return the first service. Will tcgc support multiple-services or not? if so, tcgc need to emit multiple sdkPackage. If not, maybe we need to add lint-rule to avoid.

@versioned(Versions1)
@service({
  title: "HttpbinServer",
  version: "1.0.0",
})
@server(
  "https://{domain}.{tld}",
  "Httpbin endpoint",
  {
    @doc("second-level domain, use httpbin")
    domain?: string = "httpbin",

    @doc("top-level domain, use org")
    tld?: string = "org",
  }
)
namespace Typespec.Server {
  @route("/status/{code}")
  interface ServerOp {
    status(@path code: int32): OkResponse | NoContentResponse;
  }
}
enum Versions1 {
    @useDependency(Azure.Core.Versions.v1_0_Preview_1)
    "2022-05-15-preview"
  }

enum APIVersions {
    v1: "v1",
  }

@versioned(APIVersions )
@service({
  title: "ContosoServer",
})
@server(
  "{Endpoint}/contoso/{ApiVersion}",
  "Service endpoint",
  {
    @doc("Service endpoint")
    Endpoint: string,

    @doc("Api Version")
    @path
    ApiVersion: APIVersions,
  }
)
namespace ContosoServer {

  @route("/contoso")
  interface ServerOp {
    get(@path code: int32): OkResponse | NoContentResponse;
  }
}
iscai-msft commented 2 months ago

The one sdk package doesn't just represent one service, it represents multiple services. Closing this because it's already part of the design

tadelesh commented 2 months ago

reopen since there's many design that does not consider multi-service carefully. for example, api versions, usage, etc. we need some revisit.