Skip to content

invalid-mark-as-pageable-target

Id
@azure-tools/typespec-client-generator-core/invalid-mark-as-pageable-target

Severity: warning

This diagnostic is issued when @markAsPageable is applied to an operation that does not return a model with a property decorated with @pageItems or named value.

  • Area: Legacy pageable SDK metadata. Generation continues with the operation treated as a regular method because TCGC cannot identify page items.
  • Not affected: The operation’s service response schema is unchanged.
@markAsPageable
@get
op listWidgets(): string; // pageable marker requires a page model response

TCGC reports:

@markAsPageable decorator can only be applied to operations that return a model with a property decorated with @pageItems or a property named 'value'. We will ignore this decorator.

Apply @markAsPageable only to operations returning a suitable page model, or update the response model to include @pageItems or a value property.

model Widget {
name: string;
}
model WidgetPage {
value: Widget[];
}
@markAsPageable
@get
op listWidgets(): WidgetPage;

This diagnostic should not be suppressed. Fix the target so it is a valid pageable operation, or remove @markAsPageable.