From c2c21b962cdc48b37732c2b438801d75ddd15941 Mon Sep 17 00:00:00 2001 From: Weidong Xu Date: Tue, 17 Dec 2024 12:26:34 +0800 Subject: [PATCH] allow emitter run without service --- packages/http-client-java/emitter/src/code-model-builder.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/http-client-java/emitter/src/code-model-builder.ts b/packages/http-client-java/emitter/src/code-model-builder.ts index 8a67663331..552093e446 100644 --- a/packages/http-client-java/emitter/src/code-model-builder.ts +++ b/packages/http-client-java/emitter/src/code-model-builder.ts @@ -201,11 +201,7 @@ export class CodeModelBuilder { } const service = listServices(this.program)[0]; - if (!service) { - this.logError("TypeSpec for HTTP must define a service."); - return; - } - this.serviceNamespace = service.type; + this.serviceNamespace = service?.type ?? this.program.getGlobalNamespaceType(); this.namespace = getNamespaceFullName(this.serviceNamespace) || "Azure.Client";