Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug Typescript - Missing import of discriminator function #1327

Closed
nikithauc opened this issue Mar 4, 2022 · 7 comments · Fixed by #1396
Closed

Bug Typescript - Missing import of discriminator function #1327

nikithauc opened this issue Mar 4, 2022 · 7 comments · Fixed by #1396
Assignees
Labels
fixed type:bug A broken experience TypeScript Pull requests that update Javascript code

Comments

@nikithauc
Copy link
Contributor

Generate for the Graph v1 api and the imports of create---FromDiscriminatorValue missing in some files.

@nikithauc nikithauc added type:bug A broken experience TypeScript Pull requests that update Javascript code labels Mar 4, 2022
@nikithauc nikithauc assigned nikithauc and baywet and unassigned nikithauc Mar 4, 2022
@baywet
Copy link
Member

baywet commented Mar 4, 2022

Hi @nikithauc
Thanks for reporting this.
Can you be a bit more specific about which places/cases it's missing the import so we can narrow it down to the missing scenario please?

As you can see in kiota samples, the imports are present, it wouldn't build otherwise.

https://github.com/microsoft/kiota-samples/blob/c06732cf8adc2ed3e0b62a10750fdbefd44c6a3c/msgraph-mail/typescript/src/users/item/messages/messagesRequestBuilder.ts#L1

@nikithauc
Copy link
Contributor Author

-d https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml --language typescript -o src -c GraphServiceClient -n MicrosoftGraph

The problem is in the full Graph v1 generation. When I run the above command, I encounter the error where imports are missing in some files while are present in some.

@nikithauc
Copy link
Contributor Author

Example: https://github.com/microsoftgraph/msgraph-sdk-typescript/blob/2c56fa3133de6c50c8f5fb46371b214eee6c8dea/packages/serviceLibrary/src/code/workbooks/item/createUploadSession/createUploadSessionRequestBuilder.ts#L57

packages/serviceLibrary/src/code/users/item/calendarGroups/item/calendars/item/events/item/attachments/createUploadSession/createUploadSessionRequestBuilder.ts:57:75 - error TS2304: Cannot find name 'createUploadSessionFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createUploadSessionFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/calendarGroups/item/calendars/item/events/item/instances/item/attachments/createUploadSession/createUploadSessionRequestBuilder.ts:57:75 - error TS2304: Cannot find name 'createUploadSessionFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createUploadSessionFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/calendars/item/calendarView/item/attachments/createUploadSession/createUploadSessionRequestBuilder.ts:57:75 - error TS2304: Cannot find name 'createUploadSessionFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createUploadSessionFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/calendars/item/calendarView/item/instances/item/attachments/createUploadSession/createUploadSessionRequestBuilder.ts:57:75 - error TS2304: Cannot find name 'createUploadSessionFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createUploadSessionFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/calendars/item/events/item/attachments/createUploadSession/createUploadSessionRequestBuilder.ts:57:75 - error TS2304: Cannot find name 'createUploadSessionFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createUploadSessionFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/calendars/item/events/item/instances/item/attachments/createUploadSession/createUploadSessionRequestBuilder.ts:57:75 - error TS2304: Cannot find name 'createUploadSessionFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createUploadSessionFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/calendarView/item/attachments/createUploadSession/createUploadSessionRequestBuilder.ts:57:75 - error TS2304: Cannot find name 'createUploadSessionFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createUploadSessionFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/calendarView/item/instances/item/attachments/createUploadSession/createUploadSessionRequestBuilder.ts:57:75 - error TS2304: Cannot find name 'createUploadSessionFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createUploadSessionFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/drives/item/list/contentTypes/addCopy/addCopyRequestBuilder.ts:57:73 - error TS2304: Cannot find name 'createContentTypeFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createContentTypeFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/events/item/attachments/createUploadSession/createUploadSessionRequestBuilder.ts:57:75 - error TS2304: Cannot find name 'createUploadSessionFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createUploadSessionFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/events/item/instances/item/attachments/createUploadSession/createUploadSessionRequestBuilder.ts:57:75 - error TS2304: Cannot find name 'createUploadSessionFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createUploadSessionFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/findMeetingTimes/findMeetingTimesRequestBuilder.ts:57:90 - error TS2304: Cannot find name 'createMeetingTimeSuggestionsResultFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createMeetingTimeSuggestionsResultFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/joinedTeams/item/channels/item/provisionEmail/provisionEmailRequestBuilder.ts:51:89 - error TS2304: Cannot find name 'createProvisionChannelEmailResultFromDiscriminatorValue'.

51 return this.requestAdapter?.sendAsync(requestInfo, createProvisionChannelEmailResultFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/joinedTeams/item/primaryChannel/provisionEmail/provisionEmailRequestBuilder.ts:51:89 - error TS2304: Cannot find name 'createProvisionChannelEmailResultFromDiscriminatorValue'.

51 return this.requestAdapter?.sendAsync(requestInfo, createProvisionChannelEmailResultFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/mailFolders/item/childFolders/item/copy/copyRequestBuilder.ts:57:72 - error TS2304: Cannot find name 'createMailFolderFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createMailFolderFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/mailFolders/item/childFolders/item/messages/item/attachments/createUploadSession/createUploadSessionRequestBuilder.ts:57:75 - error TS2304: Cannot find name 'createUploadSessionFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createUploadSessionFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/mailFolders/item/childFolders/item/messages/item/copy/copyRequestBuilder.ts:57:69 - error TS2304: Cannot find name 'createMessageFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createMessageFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/mailFolders/item/childFolders/item/messages/item/createForward/createForwardRequestBuilder.ts:57:69 - error TS2304: Cannot find name 'createMessageFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createMessageFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/mailFolders/item/childFolders/item/messages/item/createReply/createReplyRequestBuilder.ts:57:69 - error TS2304: Cannot find name 'createMessageFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createMessageFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/mailFolders/item/childFolders/item/messages/item/createReplyAll/createReplyAllRequestBuilder.ts:57:69 - error TS2304: Cannot find name 'createMessageFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createMessageFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/mailFolders/item/childFolders/item/messages/item/move/moveRequestBuilder.ts:57:69 - error TS2304: Cannot find name 'createMessageFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createMessageFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/mailFolders/item/childFolders/item/move/moveRequestBuilder.ts:57:72 - error TS2304: Cannot find name 'createMailFolderFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createMailFolderFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/mailFolders/item/copy/copyRequestBuilder.ts:57:72 - error TS2304: Cannot find name 'createMailFolderFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createMailFolderFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/mailFolders/item/messages/item/attachments/createUploadSession/createUploadSessionRequestBuilder.ts:57:75 - error TS2304: Cannot find name 'createUploadSessionFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createUploadSessionFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/mailFolders/item/messages/item/copy/copyRequestBuilder.ts:57:69 - error TS2304: Cannot find name 'createMessageFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createMessageFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/mailFolders/item/messages/item/createForward/createForwardRequestBuilder.ts:57:69 - error TS2304: Cannot find name 'createMessageFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createMessageFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/mailFolders/item/messages/item/createReply/createReplyRequestBuilder.ts:57:69 - error TS2304: Cannot find name 'createMessageFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createMessageFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/mailFolders/item/messages/item/createReplyAll/createReplyAllRequestBuilder.ts:57:69 - error TS2304: Cannot find name 'createMessageFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createMessageFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/mailFolders/item/messages/item/move/moveRequestBuilder.ts:57:69 - error TS2304: Cannot find name 'createMessageFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createMessageFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/mailFolders/item/move/moveRequestBuilder.ts:57:72 - error TS2304: Cannot find name 'createMailFolderFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createMailFolderFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/messages/item/attachments/createUploadSession/createUploadSessionRequestBuilder.ts:57:75 - error TS2304: Cannot find name 'createUploadSessionFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createUploadSessionFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/messages/item/copy/copyRequestBuilder.ts:57:69 - error TS2304: Cannot find name 'createMessageFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createMessageFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/messages/item/createForward/createForwardRequestBuilder.ts:57:69 - error TS2304: Cannot find name 'createMessageFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createMessageFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/messages/item/createReply/createReplyRequestBuilder.ts:57:69 - error TS2304: Cannot find name 'createMessageFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createMessageFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/messages/item/createReplyAll/createReplyAllRequestBuilder.ts:57:69 - error TS2304: Cannot find name 'createMessageFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createMessageFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/messages/item/move/moveRequestBuilder.ts:57:69 - error TS2304: Cannot find name 'createMessageFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createMessageFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/onenote/notebooks/item/copyNotebook/copyNotebookRequestBuilder.ts:57:78 - error TS2304: Cannot find name 'createOnenoteOperationFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createOnenoteOperationFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/onenote/notebooks/item/sectionGroups/item/sections/item/copyToNotebook/copyToNotebookRequestBuilder.ts:57:78 - error TS2304: Cannot find name 'createOnenoteOperationFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createOnenoteOperationFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/onenote/notebooks/item/sectionGroups/item/sections/item/copyToSectionGroup/copyToSectionGroupRequestBuilder.ts:57:78 - error TS2304: Cannot find name 'createOnenoteOperationFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createOnenoteOperationFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/onenote/notebooks/item/sectionGroups/item/sections/item/pages/item/copyToSection/copyToSectionRequestBuilder.ts:57:78 - error TS2304: Cannot find name 'createOnenoteOperationFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createOnenoteOperationFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/onenote/notebooks/item/sectionGroups/item/sections/item/pages/item/preview/previewRequestBuilder.ts:51:80 - error TS2304: Cannot find name 'createOnenotePagePreviewFromDiscriminatorValue'.

51 return this.requestAdapter?.sendAsync(requestInfo, createOnenotePagePreviewFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/onenote/notebooks/item/sections/item/copyToNotebook/copyToNotebookRequestBuilder.ts:57:78 - error TS2304: Cannot find name 'createOnenoteOperationFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createOnenoteOperationFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/onenote/notebooks/item/sections/item/copyToSectionGroup/copyToSectionGroupRequestBuilder.ts:57:78 - error TS2304: Cannot find name 'createOnenoteOperationFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createOnenoteOperationFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/onenote/notebooks/item/sections/item/pages/item/copyToSection/copyToSectionRequestBuilder.ts:57:78 - error TS2304: Cannot find name 'createOnenoteOperationFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createOnenoteOperationFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/onenote/notebooks/item/sections/item/pages/item/preview/previewRequestBuilder.ts:51:80 - error TS2304: Cannot find name 'createOnenotePagePreviewFromDiscriminatorValue'.

51 return this.requestAdapter?.sendAsync(requestInfo, createOnenotePagePreviewFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/onenote/notebooks/getNotebookFromWebUrl/getNotebookFromWebUrlRequestBuilder.ts:57:79 - error TS2304: Cannot find name 'createCopyNotebookModelFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createCopyNotebookModelFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/onenote/pages/item/copyToSection/copyToSectionRequestBuilder.ts:57:78 - error TS2304: Cannot find name 'createOnenoteOperationFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createOnenoteOperationFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/onenote/pages/item/preview/previewRequestBuilder.ts:51:80 - error TS2304: Cannot find name 'createOnenotePagePreviewFromDiscriminatorValue'.

51 return this.requestAdapter?.sendAsync(requestInfo, createOnenotePagePreviewFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/onenote/sectionGroups/item/sections/item/copyToNotebook/copyToNotebookRequestBuilder.ts:57:78 - error TS2304: Cannot find name 'createOnenoteOperationFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createOnenoteOperationFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/onenote/sectionGroups/item/sections/item/copyToSectionGroup/copyToSectionGroupRequestBuilder.ts:57:78 - error TS2304: Cannot find name 'createOnenoteOperationFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createOnenoteOperationFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/onenote/sectionGroups/item/sections/item/pages/item/copyToSection/copyToSectionRequestBuilder.ts:57:78 - error TS2304: Cannot find name 'createOnenoteOperationFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createOnenoteOperationFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/onenote/sectionGroups/item/sections/item/pages/item/preview/previewRequestBuilder.ts:51:80 - error TS2304: Cannot find name 'createOnenotePagePreviewFromDiscriminatorValue'.

51 return this.requestAdapter?.sendAsync(requestInfo, createOnenotePagePreviewFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/onenote/sections/item/copyToNotebook/copyToNotebookRequestBuilder.ts:57:78 - error TS2304: Cannot find name 'createOnenoteOperationFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createOnenoteOperationFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/onenote/sections/item/copyToSectionGroup/copyToSectionGroupRequestBuilder.ts:57:78 - error TS2304: Cannot find name 'createOnenoteOperationFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createOnenoteOperationFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/onenote/sections/item/pages/item/copyToSection/copyToSectionRequestBuilder.ts:57:78 - error TS2304: Cannot find name 'createOnenoteOperationFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createOnenoteOperationFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/onenote/sections/item/pages/item/preview/previewRequestBuilder.ts:51:80 - error TS2304: Cannot find name 'createOnenotePagePreviewFromDiscriminatorValue'.

51 return this.requestAdapter?.sendAsync(requestInfo, createOnenotePagePreviewFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/onlineMeetings/createOrGet/createOrGetRequestBuilder.ts:57:75 - error TS2304: Cannot find name 'createOnlineMeetingFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createOnlineMeetingFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/reprocessLicenseAssignment/reprocessLicenseAssignmentRequestBuilder.ts:51:66 - error TS2304: Cannot find name 'createUserFromDiscriminatorValue'.

51 return this.requestAdapter?.sendAsync(requestInfo, createUserFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/users/item/restore/restoreRequestBuilder.ts:51:77 - error TS2304: Cannot find name 'createDirectoryObjectFromDiscriminatorValue'.

51 return this.requestAdapter?.sendAsync(requestInfo, createDirectoryObjectFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/workbooks/item/copy/copyRequestBuilder.ts:57:71 - error TS2304: Cannot find name 'createDriveItemFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createDriveItemFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/workbooks/item/createLink/createLinkRequestBuilder.ts:57:72 - error TS2304: Cannot find name 'createPermissionFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createPermissionFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/workbooks/item/createUploadSession/createUploadSessionRequestBuilder.ts:57:75 - error TS2304: Cannot find name 'createUploadSessionFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createUploadSessionFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/workbooks/item/follow/followRequestBuilder.ts:51:71 - error TS2304: Cannot find name 'createDriveItemFromDiscriminatorValue'.

51 return this.requestAdapter?.sendAsync(requestInfo, createDriveItemFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/workbooks/item/preview/previewRequestBuilder.ts:57:77 - error TS2304: Cannot find name 'createItemPreviewInfoFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createItemPreviewInfoFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/serviceLibrary/src/code/workbooks/item/restore/restoreRequestBuilder.ts:57:71 - error TS2304: Cannot find name 'createDriveItemFromDiscriminatorValue'.

57 return this.requestAdapter?.sendAsync(requestInfo, createDriveItemFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));

@baywet
Copy link
Member

baywet commented Mar 8, 2022

ok so the issue is the factory methods are not imported for request executor methods. This should be an easy fix, do you want to try it?

@nikithauc nikithauc assigned nikithauc and unassigned baywet Mar 10, 2022
@nikithauc
Copy link
Contributor Author

The problem is as follows:

 public post(body: CreateUploadSessionRequestBody | undefined, h?: Record<string, string> | undefined, o?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise<UploadSession | undefined> {
        if(!body) throw new Error("body cannot be undefined");
        const requestInfo = this.createPostRequestInformation(
            body, h, o
        );
        return this.requestAdapter?.sendAsync<UploadSession>(requestInfo, createUploadSessionFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null'));
    };

In the above snippet, the class CreateUploadSessionRequestBuilder is missing the import from createUploadSessionFromDiscriminatorValue as a result there is a compile time issue.

The problem is the following condition goes false for some Post methods as the TypeDefinition is null in their return types and the imports for those discriminatorvalues are not added to the requestbuilders.

returnType.TypeDefinition != null)

@baywet
Copy link
Member

baywet commented Mar 15, 2022

thanks for the additional details, this looks to be two fold:

  1. the conversion process introduces additional anyof/union types (see OpenApi AnyOf with odata functions/actions generate invalid return types #990)
  2. the union type processing has a few limitations in Kiota, I've started addeding some of those in - fixes #1270 a bug where missing schema title would make union types fail #1381

I think the next step would be to generate the typescript SDK again with this PR and see whether it improves the situation, otherwise we'll need for 990 to be fixed as well.

@nikithauc
Copy link
Contributor Author

fixed by #1396

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed type:bug A broken experience TypeScript Pull requests that update Javascript code
Projects
None yet
2 participants