Skip to content

request-body-problem

Full name
@azure-tools/typespec-azure-core/request-body-problem

Request body should not be of raw array type. Using an array as the top-level request body prevents adding new properties in the future without introducing breaking changes. Instead, create a container model that wraps the array.

Raw array as request body:

op upload(@body body: string[]): string;

Wrap the array in a model:

model StringList {
value: string[];
}
op upload(@body body: StringList): string;
op list(@body body: string): string[];