Fields id, name, type in KeyWithPayload or KeyRepresentation are declared optional:
/** Specifies the MIME type that represents the key resource. Currently, only the default is supported. */
type?: string;
/** The v4 UUID used to uniquely identify the resource, as specified by RFC 4122. */
id?: string;
/** A human-readable name to assign to your key.
*
* To protect your privacy, do not use personal data, such as your name or location as the name for your key.
*/
name?: string;
But why would these fields ever be null for a newly created key or for a listing of a key. It is my understanding of the data model that these fields are an intrinsic part of every key and that they would always be defined.
Defining them as optional makes the client code more complex, because either a developer has to override the type hint or would have to write conditional code to handle the null situation.