-
Notifications
You must be signed in to change notification settings - Fork 301
Description
Taking a look at an OData action such as createUploadSession we have the schema as below.
'/groups/{group-id}/calendar/events/{event-id}/attachments/microsoft.graph.createUploadSession':
post:
tags:
- groups.Actions
summary: Invoke action createUploadSession
operationId: groups.group.calendar.events.event.attachments.createUploadSession
parameters:
- name: group-id
in: path
description: 'key: id of group'
required: true
schema:
type: string
x-ms-docs-key-type: group
- name: event-id
in: path
description: 'key: id of event'
required: true
schema:
type: string
x-ms-docs-key-type: event
requestBody:
description: Action parameters
content:
application/json:
schema:
type: object
properties:
AttachmentItem:
$ref: '#/components/schemas/microsoft.graph.attachmentItem'
required: true
responses:
'200':
description: Success
content:
application/json:
schema:
anyOf:
- $ref: '#/components/schemas/microsoft.graph.uploadSession'
nullable: true
default:
$ref: '#/components/responses/error'
x-ms-docs-operation-type: actionFrom this schema we see the response schema has the anyOf attribute similar to other odata actions such as getSchedule etc.
Due to the code here, since the anyOf is at the top level (this doesn't seem to happen when the anyOf property is present in a class/type property such as in the requestBody parameters in the getSchedule ), the generator generates a union type which nests the desired type when the API will return the anyOf type on the top level of the json response.
This results in generating a request builder that returns a CreateUploadSessionResponse instance where the UploadSession type is a nested property rather than the requestBuilder returning the UploadSession. Ref here
Questions
- Is it right/valid to have the anyOf when there is only one type present in the list?
- If the above is valid, maybe we should look into flattening the properties in the
anyOflist in these scenarios?
cc @baywet
Metadata
Metadata
Assignees
Labels
Type
Projects
Status