kiota: Cannot find name 'createStringFromDiscriminatorValue' when generating typescript

kiota --version
1.10.1+fa5da75b8b4f362d821032021bc5bfcf063cb522

openapi yaml like:

openapi: '3.0.2'
info:
  title: JSONPlaceholder
  version: '1.0'
servers:
  - url: https://jsonplaceholder.typicode.com/

paths:
  /api/download/{blobId}:
    parameters:
    - in: path
      name: blobId
      schema:
        type: string
      required: true
      description: BLOB ID
    get:
      summary: download temporary BLOB
      responses:
        '302':
          description: Found the BLOB and returned a signed URL to download it.
          headers:
            Location:
              required: true
              schema:
                type: string
        '400':
          description: Invalid ID
        '403':
          description: Not allowed
        '404':
          description: not found.
        default:
          description: General Error
          content:
            application/json:
              schema:
                type: string

the generated code is using createStringFromDiscriminatorValue which is not imported and not found in the item/index.ts

    public get(requestConfiguration?: RequestConfiguration<object> | undefined) : Promise<ArrayBuffer | undefined> {
        const requestInfo = this.toGetRequestInformation(
            requestConfiguration
        );
        const errorMapping = {
            "4XX": createStringFromDiscriminatorValue,
            "5XX": createStringFromDiscriminatorValue,
        } as Record<string, ParsableFactory<Parsable>>;
        return this.requestAdapter.sendPrimitiveAsync<ArrayBuffer>(requestInfo, "ArrayBuffer", errorMapping);
    }

I guess the correct one is createMessageFromDiscriminatorValue

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

no worries, just authored microsoft/kiota#4026 to address this issue.

@sword-jin we had a code-sign certificate expire last week unfortunately. Thank you for your patience while we work to renew it and unblock releases.