-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
The generated types look like so
export type ListSitesRequest = {
// Behaviors: REQUIRED
parent: string | undefined;
// Behaviors: OPTIONAL
pageSize: number | undefined;
// Behaviors: OPTIONAL
pageToken: string | undefined;
};which means typescript will make you initialize each field, even if you intend to keep it undefined
const a: ListSitesRequest = {parent: "foo/bar"}; // Type '{ parent: string; }' is missing the following properties from type 'ListSitesRequest': pageSize, pageToken
const a: ListSitesRequest = {parent: "foo/bar", pageSize: undefined, pageToken: undefined}; // passesAlternatively we could generate the optional fields this way:
export type ListSitesRequest = {
// Behaviors: REQUIRED
parent?: string;
// Behaviors?=: OPTIONAL
pageSize?: number;
// Behaviors: OPTIONAL
pageToken?: string;
};which would allow field omission for fields that the caller does not want to supply.
Is the current behavior a stylistic choice, or would we be open to changing it?
Metadata
Metadata
Assignees
Labels
No labels