microsoft / microsoft/kiota

Generated TS Client has missing import

Open
#6,884 0 comments 0 reactions 0 assignees View on GitHub
Csharp type:bug
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?

API Client/SDK

### In what context or format are you using Kiota?

Nuget tool

### Client library/SDK language

Csharp

### Describe the bug

I generated in my dotnet api with FastEndpoints.ClientGen.Kiota Version 7.0.1 a typescript client. It generates this file that is missing an import of an enum object:

Image

### Expected behavior

The import should be also include the enum object:
`import { UserAppGroup, UserAppGroupObject } from '../../../../../../models/index.js';
`

### How to reproduce

```
app.UseFastEndpoints(c =>
{
c.Endpoints.ShortNames = true;
c.Serializer.Options.Converters.Add(new JsonStringEnumConverter());
})
.UseSwaggerGen();
```

### Open API description file

```
"/api/me/apps/{appId}/group/{group}": {
"patch": {
"tags": [
"Api"
],
"operationId": "SetGroupForAppEndpoint",
"parameters": [
{
"name": "appId",
"in": "path",
"required": true,
"schema": {
"type": "integer",
"format": "int32"
}
},
{
"name": "group",
"in": "path",
"required": true,
"schema": {
"allOf": [
{
"$ref": "#/components/schemas/UserAppGroup"
}
]
}
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UserAppGroup"
}
}
}
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
}
}
}
},
```

"UserAppGroup": {
"type": "string",
"description": "",
"x-enumNames": [
"Standard",
"Favorite",
"Archived"
],
"enum": [
"Standard",
"Favorite",
"Archived"
]
},

### Kiota Version

1.28.0+57130b1b1db3bc5c060498682f41e20c8ae089f2

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

_No response_

### Known Workarounds

``

### Configuration

- OS: Windows 11
- architecture: x94

### Debug output

Click to expand log
```

```

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the provided OpenAPI description and Kiota version, then inspect the generated TypeScript client and model imports. The fix is complete when the generated import includes both UserAppGroup and UserAppGroupObject and the client compiles without a missing-import error.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, openapi, typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.