Consider this tsp:
@Xml.name("EnumerationResults")
model ListBlobsResponse {
/** The service endpoint. */
@Xml.attribute
@Xml.name("ServiceEndpoint")
serviceEndpoint: string;
/** The container name. */
@Xml.attribute
@Xml.name("ContainerName")
containerName: string;
/** The prefix of the blobs. */
@Xml.name("Prefix") prefix?: string;
/** The marker of the blobs. */
@Xml.name("Marker") marker?: string;
/** The max results of the blobs. */
@Xml.name("MaxResults") maxResults?: int32;
/** The blob segment. */
@Xml.name("Blobs")
segment: BlobFlatListSegment;
/** The next marker of the blobs. */
@continuationToken
@Xml.name("NextMarker")
nextMarker?: string;
}
/** The blob flat list segment. */
model BlobFlatListSegment {
/** The blob items. */
@pageItems
@Xml.name("Blob")
@Xml.unwrapped
blobItems: BlobItem[];
}
The service can return <Blobs /> and the current XML deserialization code will deserialize segment into null since there are no Blob elements in Blobs. Since blobItems is unwrapped and non-nullable, we should be initializing it to an empty list by default.
We should update the xml deserialization to initialize collection properties to an empty collection when they are non-nullable, required, and unwrapped.
Consider this tsp:
The service can return
<Blobs />and the current XML deserialization code will deserialize segment intonullsince there are no Blob elements inBlobs. Since blobItems is unwrapped and non-nullable, we should be initializing it to an empty list by default.We should update the xml deserialization to initialize collection properties to an empty collection when they are non-nullable, required, and unwrapped.