Skip to content

Object is not transformed into the URL variable correctly #917

Open
@altarrok

Description

@altarrok

We are using SpringDoc to generate the openapi specs of our backend, and we are using a feature of SpringDoc where commonly used Pageable object parameter is mapped automatically to openapi specs. The result of the mapping looks like this:

ss1

As you can see the Pageable parameter is defined as object. The generated request URL looks like this:

http://localhost:8080/hackathon/search?page=0&size=1&sort=location

So we can see that swagger-ui generates the correct request URL for the given Pageable object.

However -problem begins here-, when the generated client using openapi-typescript-codegen is used to make a backend call, the request URL looks like this:

http://localhost:8080/hackathon/search?pageable=%5Bobject%20Object%5D

Tracking the code, I can see that in request.ts::getQueryString arrays are accounted for but the objects aren't, and therefore the Pageable object is casted to a string, resulting in the given bug.

Is there a possible fix on our side (although I doubt that)?

A possible fix on the library side (I haven't tested) may be to call the getQueryString method recursively for each entry in the object, and concatenating the result (qs).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions