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

Missing typescript imports for createUntypedNodeFromDiscriminatorValue and UntypedNode #4925

Closed
LaurentVandenbosch opened this issue Jul 2, 2024 · 3 comments · Fixed by #4927
Assignees
Labels
type:bug A broken experience TypeScript Pull requests that update Javascript code
Milestone

Comments

@LaurentVandenbosch
Copy link

What are you generating using Kiota, clients or plugins?

API Client/SDK

In what context or format are you using Kiota?

Nuget tool

Client library/SDK language

TypeScript

Describe the bug

When I generate my typescript client with Kiota.Builder 1.14 (indirectly through FastEndpoints.ClientGen.Kiota), the resulting typescript files are missing the imports of UntypedNode and createUntypedNodeFromDiscriminatorValue from @microsoft/kiota-abstractions.

Here is an example of a file

/* tslint:disable */
/* eslint-disable */
// Generated by Microsoft Kiota
// @ts-ignore
import { createDomainExceptionResponseFromDiscriminatorValue, createGetWishlistResponseFromDiscriminatorValue, serializeAddToWishlistRequest, serializeDeleteFromWishlistRequest, type AddToWishlistRequest, type DeleteFromWishlistRequest, type DomainExceptionResponse, type GetWishlistResponse } from '../../../../models/';
// @ts-ignore
import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type RequestConfiguration, type RequestInformation, type RequestsMetadata } from '@microsoft/kiota-abstractions';

/**
 * Builds and executes requests for operations under /api/users/{userCodeOr-id}/wishlist
 */
export interface WishlistRequestBuilder extends BaseRequestBuilder<WishlistRequestBuilder> {
    /**
     * @param body The request body
     * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
     * @returns {Promise<UntypedNode>}
     * @throws {DomainExceptionResponse} error when the service returns a 422 status code
     */
     delete(body: DeleteFromWishlistRequest, requestConfiguration?: RequestConfiguration<object> | undefined) : Promise<UntypedNode | undefined>;
    /**
     * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
     * @returns {Promise<GetWishlistResponse>}
     * @throws {DomainExceptionResponse} error when the service returns a 422 status code
     */
     get(requestConfiguration?: RequestConfiguration<object> | undefined) : Promise<GetWishlistResponse | undefined>;
    /**
     * @param body The request body
     * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
     * @returns {Promise<UntypedNode>}
     * @throws {DomainExceptionResponse} error when the service returns a 422 status code
     */
     post(body: AddToWishlistRequest, requestConfiguration?: RequestConfiguration<object> | undefined) : Promise<UntypedNode | undefined>;
    /**
     * @param body The request body
     * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
     * @returns {RequestInformation}
     */
     toDeleteRequestInformation(body: DeleteFromWishlistRequest, requestConfiguration?: RequestConfiguration<object> | undefined) : RequestInformation;
    /**
     * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
     * @returns {RequestInformation}
     */
     toGetRequestInformation(requestConfiguration?: RequestConfiguration<object> | undefined) : RequestInformation;
    /**
     * @param body The request body
     * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
     * @returns {RequestInformation}
     */
     toPostRequestInformation(body: AddToWishlistRequest, requestConfiguration?: RequestConfiguration<object> | undefined) : RequestInformation;
}
/**
 * Uri template for the request builder.
 */
export const WishlistRequestBuilderUriTemplate = "{+baseurl}/api/users/{userCodeOr%2Did}/wishlist";
/**
 * Metadata for all the requests in the request builder.
 */
export const WishlistRequestBuilderRequestsMetadata: RequestsMetadata = {
    delete: {
        uriTemplate: WishlistRequestBuilderUriTemplate,
        responseBodyContentType: "text/plain;q=0.9",
        errorMappings: {
            422: createDomainExceptionResponseFromDiscriminatorValue as ParsableFactory<Parsable>,
        },
        adapterMethodName: "send",
        responseBodyFactory:  createUntypedNodeFromDiscriminatorValue,
        requestBodyContentType: "application/json",
        requestBodySerializer: serializeDeleteFromWishlistRequest,
        requestInformationContentSetMethod: "setContentFromParsable",
    },
    get: {
        uriTemplate: WishlistRequestBuilderUriTemplate,
        responseBodyContentType: "application/json",
        errorMappings: {
            422: createDomainExceptionResponseFromDiscriminatorValue as ParsableFactory<Parsable>,
        },
        adapterMethodName: "send",
        responseBodyFactory:  createGetWishlistResponseFromDiscriminatorValue,
    },
    post: {
        uriTemplate: WishlistRequestBuilderUriTemplate,
        responseBodyContentType: "text/plain;q=0.9",
        errorMappings: {
            422: createDomainExceptionResponseFromDiscriminatorValue as ParsableFactory<Parsable>,
        },
        adapterMethodName: "send",
        responseBodyFactory:  createUntypedNodeFromDiscriminatorValue,
        requestBodyContentType: "application/json",
        requestBodySerializer: serializeAddToWishlistRequest,
        requestInformationContentSetMethod: "setContentFromParsable",
    },
};
/* tslint:enable */
/* eslint-enable */

Expected behavior

The import should include UntypedNode and createUntypedNodeFromDiscriminatorValue

How to reproduce

Difficult to say which condition causes this

Open API description file

No response

Kiota Version

1.14

Latest Kiota version known to work for scenario above?(Not required)

No response

Known Workarounds

No response

Configuration

No response

Debug output

Click to expand log ```
</details>


### Other information

_No response_
@LaurentVandenbosch LaurentVandenbosch added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels Jul 2, 2024
@github-project-automation github-project-automation bot moved this to Needs Triage 🔍 in Kiota Jul 2, 2024
@msgraph-bot msgraph-bot bot added the TypeScript Pull requests that update Javascript code label Jul 2, 2024
@baywet
Copy link
Member

baywet commented Jul 2, 2024

Hi @LaurentVandenbosch
Thank you for using kiota and for reaching out.
Can you try with version 1.15 and tell us if you are still seeing the issue please?

@baywet baywet added question status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close type:question An issue that's a question and removed type:bug A broken experience status:waiting-for-triage An issue that is yet to be reviewed or assigned labels Jul 2, 2024
@baywet baywet moved this from Needs Triage 🔍 to Waits for author 🔁 in Kiota Jul 2, 2024
@LaurentVandenbosch
Copy link
Author

Hello @baywet ,

The issue is still present with 1.15. I have to use 1.12 to not have this issue, because it doesnt use UntypedNode.

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Attention 👋 and removed status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close labels Jul 3, 2024
@andrueastman
Copy link
Member

Authored #4927 to resolve.

@andrueastman andrueastman added this to the Kiota v1.16 milestone Jul 3, 2024
@andrueastman andrueastman added type:bug A broken experience and removed question Needs: Attention 👋 type:question An issue that's a question labels Jul 3, 2024
@andrueastman andrueastman self-assigned this Jul 3, 2024
@andrueastman andrueastman moved this from Waits for author 🔁 to In Progress 🚧 in Kiota Jul 3, 2024
@github-project-automation github-project-automation bot moved this from In Progress 🚧 to Done ✔️ in Kiota Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug A broken experience TypeScript Pull requests that update Javascript code
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants