microsoft / microsoft/kiota

Support deepobject parameter style

Open
#6,852 1 comment 0 reactions 0 assignees View on GitHub
Csharp type:feature type:investigation
Dominant language
C#
Stars
3.8k
Forks
333
Avg merge
16h 29m
Merged PRs (30d)
116

Description

### Is your feature request related to a problem? Please describe the problem.

Hi @baywet

Recently one of the APIs I use moved over to deepobject style parameters.

See the following OpenAPI:

```json
{
"name": "page",
"in": "query",
"style": "deepObject",
"explode": true,
"description": "Consolidated page parameter (deepObject style). Originally: page[number], page[size]",
"schema": {
"type": "object",
"properties": {
"number": {
"type": "integer",
"default": 1
},
"size": {
"maximum": 250,
"type": "integer",
"default": 20
}
}
},
"examples": {
"page[number]=1&page[size]=20": {
"value": {
"number": 1,
"size": 20
},
"summary": "Default pagination with first page and 20 records per page"
},
"summary": "Fifth page with 100 records per page"
}
}
```

After generating, I receive a xyzQueryParameters object in C#, but it's just a string `Page` property. I can set that property, but in the url it ends up building something like `Page=xyz`, and that doesn't work.

### Client library/SDK language

Csharp

### Describe the solution you'd like

If xyzQueryParameter at least had like an `AdditionalProperties` backing dictionary or a raw `AddQueryParameter()` method, I could use that, but right now I'm having to build the url manually and use `WithUrl()` which isn't fun. Overall, I'm hoping for some robust, non-fragile way that works with intellisense... but I'm not sure if that's possible.

If there's some sort of massaging I can do to the OpenAPI file, I'd also take that solution...

### Additional context

I saw this: https://github.com/microsoft/kiota/issues/3800, I was unsure what exactly was the overall determination there

Contributor guide

Open the contributing guide

Research direction

Start by reading the referenced issue #3800 and tracing how the generated xyzQueryParameters class represents the deepObject parameter. Reproduce the C# URL produced from the supplied OpenAPI example and compare it with the required page[number] and page[size] form. Done should be a clearly defined, robust deepObject query-serialization behavior or a documented supported workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, openapi
Domain
api, backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.