Skip to content

non-head-bool-response-decorator

Id
@azure-tools/typespec-client-generator-core/non-head-bool-response-decorator

Severity: warning

This diagnostic is issued when @responseAsBool is applied to an operation that is not decorated with @head.

  • Area: HEAD response convenience modeling. Generation continues, but @responseAsBool is ignored because the operation is not a HEAD request.
  • Not affected: The operation’s HTTP verb and response schema are unchanged.
@responseAsBool
@get // `@responseAsBool` requires a HEAD operation
op exists(): void;

TCGC reports:

@responseAsBool decorator can only be used on HEAD operations. Will ignore decorator on getOperation.

Add @head when the operation is a HEAD request, or remove @responseAsBool:

@responseAsBool
@head
op exists(): void;

Suppress this warning only if @responseAsBool is intentionally ignored because the operation is not a HEAD operation for this emitter.

#suppress "@azure-tools/typespec-client-generator-core/non-head-bool-response-decorator" "non-HEAD boolean response is intentional"