microsoft / microsoft/kiota

Freeze/Stale when generating client

Open
#4,653 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Needs: Attention :wave: type:question
Dominant language
C#
Stars
3.8k
Forks
333
Avg merge
16h 29m
Merged PRs (30d)
116

Description

What are you generating using Kiota, clients or plugins?

Kiota plugin

In what context or format are you using Kiota?

Windows executable

Client library/SDK language

TypeScript

Describe the bug

I'm trying to generate the client based on the specified OpenAPI file, but Kiota freezes when it tries to generate the client.

Expected behavior

Kiota shouldn't freeze. I don't think there's an error with the specifications, as other client generators generate valid clients from my tests.

How to reproduce

Try to generate client via generate command I'm using this:

kiota generate -l typescript -d http://localhost:8080/openapi?format=json -c Client -o ./src/client --co

Your path will be different obviously.

Open API description file
openapi: 3.0.3
info:
  title: api-service API
  version: 0.0.1
tags:
  - name: Environment Management
    description: API for managing environments
  - name: Private Service Management
    description: API for managing private services
  - name: Project Management
    description: API for managing projects
  - name: Proxy Admin Service
    description: API for managing proxy rules
paths:
  /v1/environments/{environment}:
    get:
      tags:
        - Environment Management
      summary: Get Environment
      description: Retrieves a specific environment
      parameters:
        - name: environment
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/UUID'
      responses:
        '200':
          description: Environment retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Environment'
        '401':
          description: Not Authorized
        '403':
          description: Not Allowed
        '404':
          description: Environment not found
      security:
        - SecurityScheme: []
  /v1/environments/{environment}/private-services:
    get:
      tags:
        - Private Service Management
      summary: List Private Services
      description: Lists all private services within the specified environment.
      parameters:
        - name: environment
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/UUID'
      responses:
        '200':
          description: Private services retrieved successfully
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/PrivateServiceResponse'
        '401':
          description: Not Authorized
        '403':
          description: Not Allowed
      security:
        - SecurityScheme: []
    post:
      tags:
        - Private Service Management
      summary: Create Private Service
      description: Creates a new private service within the specified environment.
      parameters:
        - name: environment
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/UUID'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PrivateService'
      responses:
        '200':
          description: Private service created successfully
          content:
            application/json: {}
        '401':
          description: Not Authorized
        '403':
          description: Not Allowed
      security:
        - SecurityScheme: []
  /v1/environments/{environment}/private-services/{service}:
    get:
      tags:
        - Private Service Management
      summary: Get Private Service
      description: Gets the specified private service.
      parameters:
        - name: environment
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/UUID'
        - name: service
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/UUID'
      responses:
        '200':
          description: Private service retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PrivateServiceResponse'
        '401':
          description: Not Authorized
        '403':
          description: Not Allowed
      security:
        - SecurityScheme: []
    delete:
      tags:
        - Private Service Management
      summary: Delete Private Service
      description: Deletes the specified private service.
      parameters:
        - name: environment
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/UUID'
        - name: service
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/UUID'
      responses:
        '200':
          description: Private service deleted successfully
          content:
            application/json: {}
        '401':
          description: Not Authorized
        '403':
          description: Not Allowed
      security:
        - SecurityScheme: []
    patch:
      tags:
        - Private Service Management
      summary: Update Private Service
      description: Updates the specified private service.
      parameters:
        - name: environment
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/UUID'
        - name: service
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/UUID'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PrivateService'
      responses:
        '200':
          description: Private service updated successfully
          content:
            application/json: {}
        '401':
          description: Not Authorized
        '403':
          description: Not Allowed
      security:
        - SecurityScheme: []
  /v1/environments/{environment}/private-services/{service}/deploy:
    post:
      tags:
        - Private Service Management
      summary: Is Deployable Image
      description: Checks if the app image is deployable.
      parameters:
        - name: environment
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/UUID'
        - name: service
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/UUID'
      responses:
        '200':
          description: Deployable image check completed
          content:
            application/json:
              schema:
                type: boolean
  /v1/environments/{environment}/proxy:
    post:
      tags:
        - Proxy Admin Service
      summary: Create Proxy Rule
      description: Creates a new proxy rule.
      parameters:
        - name: environment
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/UUID'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateProxyRequest'
      responses:
        '200':
          description: Proxy rule created successfully
          content: {}
        '401':
          description: Not Authorized
        '403':
          description: Not Allowed
      security:
        - SecurityScheme: []
  /v1/environments/{environment}/proxy/list/{application}:
    get:
      tags:
        - Proxy Admin Service
      summary: List Proxy Rules
      description: Lists all proxy rules for an application.
      parameters:
        - name: application
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/UUID'
        - name: environment
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/UUID'
      responses:
        '200':
          description: Proxy rules retrieved successfully
          content: {}
        '401':
          description: Not Authorized
        '403':
          description: Not Allowed
      security:
        - SecurityScheme: []
  /v1/environments/{environment}/proxy/{proxy}:
    delete:
      tags:
        - Proxy Admin Service
      summary: Delete Proxy Rule
      description: Deletes a proxy rule.
      parameters:
        - name: environment
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/UUID'
        - name: proxy
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/UUID'
      responses:
        '200':
          description: Proxy rule deleted successfully
          content:
            application/json: {}
        '401':
          description: Not Authorized
        '403':
          description: Not Allowed
      security:
        - SecurityScheme: []
  /v1/projects:
    get:
      tags:
        - Project Management
      summary: List Projects
      description: Lists all projects
      responses:
        '200':
          description: Projects retrieved successfully
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Project'
    post:
      tags:
        - Project Management
      summary: Create Project
      description: Creates a new project
      responses:
        '200':
          description: Project created successfully
          content:
            application/json: {}
  /v1/projects/{project}:
    get:
      tags:
        - Project Management
      summary: Get Project
      description: Retrieves a project
      parameters:
        - name: project
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/UUID'
      responses:
        '200':
          description: Project retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Project'
        '401':
          description: Not Authorized
        '403':
          description: Not Allowed
        '404':
          description: Project not found
      security:
        - SecurityScheme: []
    delete:
      tags:
        - Project Management
      summary: Delete Project
      description: Deletes a project
      parameters:
        - name: project
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/UUID'
      responses:
        '200':
          description: Project deleted successfully
          content:
            application/json: {}
        '401':
          description: Not Authorized
        '403':
          description: Not Allowed
        '404':
          description: Project not found
      security:
        - SecurityScheme: []
  /v1/projects/{project}/environments:
    get:
      tags:
        - Environment Management
      summary: List Environments
      description: Lists all environments within a project
      parameters:
        - name: project
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/UUID'
      responses:
        '200':
          description: Environments retrieved successfully
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Environment'
        '401':
          description: Not Authorized
        '403':
          description: Not Allowed
        '404':
          description: Project not found
      security:
        - SecurityScheme: []
    post:
      tags:
        - Environment Management
      summary: Create Environment
      description: Creates a new environment within a project
      parameters:
        - name: project
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/UUID'
      responses:
        '200':
          description: Environment created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Environment'
        '401':
          description: Not Authorized
        '403':
          description: Not Allowed
        '404':
          description: Project not found
      security:
        - SecurityScheme: []
  /v1/projects/{project}/environments/{environment}:
    delete:
      tags:
        - Environment Management
      summary: Delete Environment
      description: Deletes an environment from a project
      parameters:
        - name: environment
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/UUID'
        - name: project
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/UUID'
      responses:
        '200':
          description: Environment deleted successfully
          content:
            application/json: {}
        '401':
          description: Not Authorized
        '403':
          description: Not Allowed
      security:
        - SecurityScheme: []
  /v1/projects/{project}/members:
    get:
      tags:
        - Project Management
      summary: List Project Members
      description: Lists all members for a project
      parameters:
        - name: project
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/UUID'
      responses:
        '200':
          description: Project members retrieved successfully
          content:
            application/json: {}
  /v1/projects/{project}/roles:
    get:
      tags:
        - Project Management
      summary: List Project Roles
      description: Lists all roles for a project
      parameters:
        - name: project
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/UUID'
      responses:
        '200':
          description: Project roles retrieved successfully
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ProjectRole'
        '401':
          description: Not Authorized
        '403':
          description: Not Allowed
      security:
        - SecurityScheme: []
    post:
      tags:
        - Project Management
      summary: Create Project Role
      description: Creates a new role for a project
      parameters:
        - name: project
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/UUID'
      responses:
        '200':
          description: Project role created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProjectRole'
        '401':
          description: Not Authorized
        '403':
          description: Not Allowed
      security:
        - SecurityScheme: []
  /v1/projects/{project}/roles/{role}:
    delete:
      tags:
        - Project Management
      summary: Delete Project Role
      description: Deletes a role from a project
      parameters:
        - name: project
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/UUID'
        - name: role
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Project role deleted successfully
          content:
            application/json: {}
        '401':
          description: Not Authorized
        '403':
          description: Not Allowed
      security:
        - SecurityScheme: []
    patch:
      tags:
        - Project Management
      summary: Update Project Role
      description: Updates a role in a project
      parameters:
        - name: project
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/UUID'
        - name: role
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Project role updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProjectRole'
        '401':
          description: Not Authorized
        '403':
          description: Not Allowed
      security:
        - SecurityScheme: []
  /v1/projects/{project}/skus:
    get:
      tags:
        - Project Management
      summary: List Project SKUs
      description: Lists available SKUs for a project
      parameters:
        - name: project
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/UUID'
      responses:
        '200':
          description: Project SKUs retrieved successfully
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/SKU'
        '401':
          description: Not Authorized
        '403':
          description: Not Allowed
      security:
        - SecurityScheme: []
components:
  schemas:
    Action:
      enum:
        - ADMIN
        - READ
        - WRITE
      type: string
    Autoscaling:
      description: Represents autoscaling configuration for a resource
      type: object
      properties:
        uid:
          description: Unique identifier for the autoscaling configuration
          type: string
          allOf:
            - $ref: '#/components/schemas/UUID'
        enabled:
          description: Indicates whether autoscaling is enabled
          type: boolean
        metricType:
          description: The metric type used for autoscaling (e.g., 'cpu')
          type: string
        targetUtilization:
          format: int32
          description: The target utilization percentage for the metric
          type: integer
        minReplicas:
          format: int32
          description: The minimum number of replicas to maintain
          type: integer
        maxReplicas:
          format: int32
          description: The maximum number of replicas allowed
          type: integer
    Container:
      description: Represents a container configuration
      required:
        - sourceRepository
        - image
      type: object
      properties:
        uid:
          description: Unique identifier for the container
          type: string
          allOf:
            - $ref: '#/components/schemas/UUID'
        sourceRepository:
          description: The source repository for the container image
          pattern: \S
          type: string
        image:
          description: The name of the container image
          pattern: \S
          type: string
        cpuAllocation:
          format: float
          description: The CPU allocation for the container
          type: number
        memoryAllocation:
          format: int32
          description: The memory allocation (in MB) for the container
          type: integer
        environmentVariables:
          description: Environment variables for the container
          type: array
          items:
            type: object
            properties:
              name:
                description: The name of the environment variable
                type: string
              value:
                description: The value of the environment variable
                type: string
        ports:
          description: Ports exposed by the container
          type: array
          items:
            type: object
            properties:
              name:
                description: The name of the port (optional)
                type: string
              port:
                format: int32
                description: The port number exposed by the container
                type: integer
              protocol:
                description: The protocol used by the port (TCP or UDP)
                type: string
    CreateProxyRequest:
      type: object
      properties:
        application:
          $ref: '#/components/schemas/UUID'
        port:
          format: int32
          type: integer
    Environment:
      description: Represents an environment within a project
      type: object
      properties:
        uid:
          description: Unique identifier for the environment
          type: string
          allOf:
            - $ref: '#/components/schemas/UUID'
        project:
          description: The project to which this environment belongs
          type: object
          allOf:
            - $ref: '#/components/schemas/Project'
        name:
          description: The name of the environment
          type: string
        description:
          description: The description of the environment
          type: string
        isActive:
          description: Indicates if the environment is active
          type: boolean
        createdAt:
          description: The timestamp when the environment was created
          type: string
          allOf:
            - $ref: '#/components/schemas/LocalDateTime'
        updatedAt:
          description: The timestamp when the environment was last updated
          type: string
          allOf:
            - $ref: '#/components/schemas/LocalDateTime'
        active:
          type: boolean
    LocalDateTime:
      format: date-time
      type: string
      example: '2022-03-10T12:15:50'
    PrivateService:
      description: Represents a private service configuration
      required:
        - name
        - sku
      type: object
      properties:
        uid:
          $ref: '#/components/schemas/UUID'
        environment:
          $ref: '#/components/schemas/Environment'
        name:
          description: Name of the private service
          pattern: \S
          type: string
        sku:
          description: SKU of the private service instance
          pattern: \S
          type: string
        containerEntity:
          description: Container configuration for the private service
          type: object
          allOf:
            - $ref: '#/components/schemas/Container'
        autoscalingEntity:
          description: Autoscaling configuration for the private service
          type: object
          allOf:
            - $ref: '#/components/schemas/Autoscaling'
        createdAt:
          description: Timestamp when the private service was created
          type: string
          allOf:
            - $ref: '#/components/schemas/LocalDateTime'
        updatedAt:
          description: Timestamp when the private service was last updated
          type: string
          allOf:
            - $ref: '#/components/schemas/LocalDateTime'
        deletedAt:
          description: Timestamp when the private service was deleted (if applicable)
          type: string
          allOf:
            - $ref: '#/components/schemas/LocalDateTime'
    PrivateServiceResponse:
      type: object
      properties:
        resource:
          $ref: '#/components/schemas/PrivateService'
        status:
          $ref: '#/components/schemas/ServiceStatus'
    Project:
      description: Represents a project containing environments
      type: object
      properties:
        uid:
          description: Unique identifier for the project
          type: string
          allOf:
            - $ref: '#/components/schemas/UUID'
        name:
          description: Name of the project
          type: string
        description:
          description: Description of the project
          type: string
        purpose:
          description: Purpose of the project
          type: string
        createdBy:
          description: User ID who created the project
          type: string
        baseEnvironment:
          description: Base environment for the project
          type: object
          allOf:
            - $ref: '#/components/schemas/Environment'
        baseRole:
          description: Base role for the project
          type: object
          allOf:
            - $ref: '#/components/schemas/ProjectRole'
        environments:
          description: List of environments associated with the project
          type: array
          items:
            description: Represents an environment within a project
            type: object
            properties:
              uid:
                description: Unique identifier for the environment
                type: string
                allOf:
                  - $ref: '#/components/schemas/UUID'
              project:
                description: The project to which this environment belongs
                type: object
                allOf:
                  - $ref: '#/components/schemas/Project'
              name:
                description: The name of the environment
                type: string
              description:
                description: The description of the environment
                type: string
              isActive:
                description: Indicates if the environment is active
                type: boolean
              createdAt:
                description: The timestamp when the environment was created
                type: string
                allOf:
                  - $ref: '#/components/schemas/LocalDateTime'
              updatedAt:
                description: The timestamp when the environment was last updated
                type: string
                allOf:
                  - $ref: '#/components/schemas/LocalDateTime'
              active:
                type: boolean
        createdAt:
          description: Timestamp when the project was created
          type: string
          allOf:
            - $ref: '#/components/schemas/LocalDateTime'
        updatedAt:
          description: Timestamp when the project was last updated
          type: string
          allOf:
            - $ref: '#/components/schemas/LocalDateTime'
    ProjectMember:
      description: Represents a member of a project and their assigned role
      type: object
      properties:
        uid:
          description: Unique identifier for the project member entry
          type: string
          allOf:
            - $ref: '#/components/schemas/UUID'
        project:
          description: The project to which this member belongs
          type: object
          allOf:
            - $ref: '#/components/schemas/Project'
        member:
          description: The user ID of the project member
          type: string
        role:
          description: The role assigned to the project member
          type: object
          allOf:
            - $ref: '#/components/schemas/ProjectRole'
    ProjectRole:
      description: Represents a role within a project with associated permissions
      type: object
      properties:
        uid:
          description: Unique identifier for the project role
          type: string
          allOf:
            - $ref: '#/components/schemas/UUID'
        project:
          description: The project to which this role belongs
          type: object
          allOf:
            - $ref: '#/components/schemas/Project'
        name:
          description: Unique name of the role
          type: string
        displayName:
          description: Display name of the role (for user interfaces)
          type: string
        description:
          description: Description of the role's purpose
          type: string
        permissions:
          description: List of permissions associated with the role
          type: array
          items:
            type: object
            properties:
              api:
                type: string
              actions:
                type: array
                items:
                  $ref: '#/components/schemas/Action'
        createdBy:
          description: User ID who created the role
          type: string
        createdAt:
          description: Timestamp when the role was created
          type: string
          allOf:
            - $ref: '#/components/schemas/LocalDateTime'
        updatedAt:
          description: Timestamp when the role was last updated
          type: string
          allOf:
            - $ref: '#/components/schemas/LocalDateTime'
    ProxyRuleEntity:
      type: object
      properties:
        uid:
          $ref: '#/components/schemas/UUID'
        environment:
          $ref: '#/components/schemas/Environment'
        externalPort:
          format: int32
          type: integer
        targetApplicationId:
          $ref: '#/components/schemas/UUID'
        targetApplicationPort:
          format: int32
          type: integer
    SKU:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        family:
          type: string
        cpu:
          format: float
          type: number
        memory:
          format: int32
          type: integer
        price:
          format: float
          type: number
    ServiceStatus:
      type: object
      properties:
        uid:
          type: string
        environment:
          type: string
        state:
          $ref: '#/components/schemas/State'
        message:
          type: string
        currentReplicas:
          format: int32
          type: integer
        lastHeartbeat:
          $ref: '#/components/schemas/LocalDateTime'
    State:
      enum:
        - ERROR
        - WARNING
        - SUCCESS
        - INFO
        - STOPPED
        - PENDING
        - IN_PROGRESS
        - LOADING
      type: string
    UUID:
      format: uuid
      pattern: '[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}'
      type: string
  securitySchemes:
    SecurityScheme:
      type: http
      description: Authentication
      scheme: bearer
      bearerFormat: Opaque
Kiota Version

1.14.0+fc4b39c65d89f7bfc8c7f1813c197e95e206da09

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

No response

Known Workarounds

No response

Configuration
  • OS: Windows 11
  • architecture: x64
Debug output
Click to expand log ``` Warning: the TypeScript language is in preview (Preview) some features are not fully supported and source breaking changes will happen with future updates. info: Kiota.Builder.KiotaBuilder[0] Cleaning output directory dbug: Kiota.Builder.KiotaBuilder[0] kiota version 1.14.0 dbug: Kiota.Builder.KiotaBuilder[0] cache file C:\Users\daniel\AppData\Local\Temp\kiota\cache\generation\69C78F8D208172ABCCFD4741296BF1D28E5AECEC57EA6730F0559615D9FF23D5\openapi not found, downloading from http://localhost:8080/openapi?format=json info: Kiota.Builder.KiotaBuilder[0] skipping cache write for URI http://localhost:8080/openapi?format=json as it is a loopback address info: Kiota.Builder.KiotaBuilder[0] loaded description from remote source dbug: Kiota.Builder.KiotaBuilder[0] step 1 - reading the stream - took 00:00:02.1362970 warn: Kiota.Builder.KiotaBuilder[0] OpenAPI warning: #/ - A servers entry (v3) or host + basePath + schemes properties (v2) was not present in the OpenAPI description. The root URL will need to be set manually with the request adapter. dbug: Kiota.Builder.KiotaBuilder[0] step 2 - parsing the document - took 00:00:00.1707046 dbug: Kiota.Builder.KiotaBuilder[0] step 3 - updating generation configuration from kiota extension - took 00:00:00.0001302 dbug: Kiota.Builder.KiotaBuilder[0] step 4 - filtering API paths with patterns - took 00:00:00.0050800 warn: Kiota.Builder.KiotaBuilder[0] No server url found in the OpenAPI document. The base url will need to be set when using the client. dbug: Kiota.Builder.KiotaBuilder[0] step 5 - checking whether the output should be updated - took 00:00:00.0200458 dbug: Kiota.Builder.KiotaBuilder[0] step 6 - create uri space - took 00:00:00.0053731 dbug: Kiota.Builder.KiotaBuilder[0] InitializeInheritanceIndex 00:00:00.0035627
</details>


### Other information

I have tried this on 2 devices on one device kiota is installed via dotnet on second I have binaries added in path and both have same version.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the kiota generate -l typescript command against the supplied OpenAPI description on Windows, then inspect where generation stops and capture diagnostic output. Done means the generator completes instead of freezing for this specification and a regression check covers the failure case.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, openapi, typescript
Domain
api, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.