auto-merge-service-conflict
@azure-tools/typespec-client-generator-core/auto-merge-service-conflictSeverity: error
This diagnostic is issued when a parent client uses autoMergeService and a nested client also specifies its own service configuration.
Impact
Section titled “Impact”- Area: Multi-service client hierarchy. Blocks an auto-merged parent client from also containing a nested client with its own explicit service binding.
- Not affected: The underlying service namespaces and routes remain valid independently.
❌ Incorrect Usage
Section titled “❌ Incorrect Usage”@servicenamespace ServiceA { @route("/aTest") op opA(): void;}
@servicenamespace ServiceB { @route("/bTest") op opB(): void;}
@client({ name: "ParentClient", service: [ServiceA, ServiceB], autoMergeService: true,})namespace ParentClient { @client({ name: "ChildClient", service: ServiceA, // child service conflicts with the parent's `autoMergeService` }) namespace Child {
}}Diagnostic Message
Section titled “Diagnostic Message”TCGC reports:
Auto-merging service client must be empty.✅ How to Fix
Section titled “✅ How to Fix”Leave the nested client’s service option unset so it inherits from the parent, or remove the parent autoMergeService setup.
@servicenamespace ServiceA { @route("/aTest") op opA(): void;}
@servicenamespace ServiceB { @route("/bTest") op opB(): void;}
@client({ name: "ParentClient", service: [ServiceA, ServiceB], autoMergeService: true,})namespace ParentClient { @client({ name: "ChildClient", }) namespace Child {
}}