Skip to content

[BUG] Wrong interface generation (nested object in request) #1031

Open
@aleksGorinN26

Description

@aleksGorinN26

Hello! I observe the problem with the interface generation for a specific case.
I have an endpoint that accepts the following interface:

{
  userId: string;
  page: {
    size: number;
    number: number;
  };
};

Since this endpoint is GET, the query string should be like: ?userId=abc123&page.size=20&page.number=1

But generated interface for this endpoint looks:

{
  userId: string;
  pageSize: number;
  pageNumber: number;
}

Which leads to generate the next query string: ?userId=abc123&pageSize=20&pageNumber=1

I'd expect one of the following interfaces:

{
  userId: string;
  'page.size': number;
  'page.number': number;
}

Or it could be like original one:

{
  userId: string;
  page: {
    size: number;
    number: number;
  };
};

I think this structure can be transformed to expected by endpoint format.

Example of schema the service has:

"get": {
                "tags": [
                    "some-tag"
                ],
                "summary": "summary",
                "description": "description",
                "operationId": "operationId",
                "parameters": [
                    {
                        "name": "userId",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "page.size",
                        "in": "query"
                    },
                    {
                        "name": "page.number",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/someContentHere"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "type": "object",
                                    "example": "example"
                                }
                            }
                        }
                    }
                },
            },

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions