Skip to content

client-location-wrong-type

Id
@azure-tools/typespec-client-generator-core/client-location-wrong-type

Severity: warning

This diagnostic is issued when an operation marked with @clientLocation points to a target that is not a valid client location under the root namespace decorated with @service.

  • Area: Client operation placement. Generation continues, but the operation cannot be moved to a target outside the valid service client hierarchy.
  • Not affected: The operation’s HTTP route and protocol metadata are unchanged.
namespace OtherNamespace {
}
@service
namespace MyService {
@clientLocation(OtherNamespace) // target is outside the `MyService` service namespace
op list(): void;
}

TCGC reports:

`@clientLocation` could only move operation to the interface or namespace belong to the root namespace with `@service`.

Move the operation to an interface or namespace that belongs to the root service namespace, or define the intended target as a valid client under that service.

@service
namespace MyService {
namespace Operations {
}
@clientLocation(Operations)
op list(): void;
}

This diagnostic should not be suppressed. Move the operation to an interface or namespace that belongs to the root @service namespace.