microsoft / microsoft/kiota

Wrong QueryParameters property is generated from AnyOf with array

Open
#7,210 0 comments 0 reactions 0 assignees View on GitHub
Csharp status:waiting-for-triage 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

When using anyOf with an array the wrong QueryParameters property is generated.

### Expected behavior

Generate the correct QueryParameters property.

### How to reproduce

Use the following specification:

```
{
"name": "ids",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "array",
"items": {
"type": "string"
}
},
{
"type": "null"
}
],
"max_items": 10,
"default": [],
"title": "ids"
}
}
```

It will create:
```
[QueryParameter("ids")]
public string? ids { get; set; }
```

Shouldn't this create an array instead?

### Open API description file

_No response_

### Kiota Version

1.29.0

### 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
```

```

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the provided OpenAPI query parameter schema using Kiota 1.29.0, then trace how the anyOf array schema becomes the generated QueryParameters property. Done means the generated C# property represents an array of strings rather than a nullable string.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
devtools
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.