Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
aleksGorinN26 opened this issue Jan 21, 2025 · 1 comment
Open

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

aleksGorinN26 opened this issue Jan 21, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@aleksGorinN26
Copy link

aleksGorinN26 commented Jan 21, 2025

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"
                                }
                            }
                        }
                    }
                },
            },
@smorimoto smorimoto added the bug Something isn't working label Mar 26, 2025
@FDiskas
Copy link

FDiskas commented May 2, 2025

Yes I also would like to have ability to pass custom query formater

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants