Skip to content

[BUG] [Angular] Form-Query-Params for recursive objects don't include property path #23895

@angelaki

Description

@angelaki

In my C# WebAPI I have a key[(key/value)] query param ([FromQuery] IDictionary<string, IDictionary<string, string>> properties) producing the following OpenAPI schema:

{ "name": "properties", "in": "query", "schema": { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "string" } } } },

Generator 7.11 recursively added the properties so that e.g. an object {a:{x:1}} was passed as a.x=1 to the query params:

Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
   httpParams, value[k], key != null ? `${key}.${k}` : k));

The current version doesn't include the key:

if (explode) {
   Object.keys(value).forEach(k => {
      httpParams = this.addToHttpParams(httpParams, k, value[k], paramStyle, explode);
   });
   return httpParams;
}

always resulting in x=1. The full path to the property is lost. I guess the old logic needed to be used here, too but this will sure change the current behavior (what just is wrong, isn't it?). I'm going to create a PR immediatelly.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions