You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A query parameter of type: object using additionalProperties produces Typescript code that fails to compile.
A similar parameter without additionalProperties that instead specifies properties compiles properly, but serializes the parameter improperly.
Typescript compiler error with additionalProperties
api/test/apis/DefaultApi.ts
Type error: Type '{ [key: string]: number; }' is not assignable to type 'string | number | boolean | (string | number | boolean)[]'.
Type '{ [key: string]: number; }' is not assignable to type 'string'. TS2322
30 |
31 | if (requestParameters.foffset !== undefined) {
> 32 | queryParameters['foffset'] = requestParameters.foffset;
| ^
33 | }
34 |
35 | const headerParameters: runtime.HTTPHeaders = {};
Invalid serialization with specified properties
The parameter is decoded to the string representation of an object in Javascript:
Bug Report Checklist
Description
A query parameter of
type: object
usingadditionalProperties
produces Typescript code that fails to compile.A similar parameter without
additionalProperties
that instead specifies properties compiles properly, but serializes the parameter improperly.Typescript compiler error with
additionalProperties
Invalid serialization with specified properties
The parameter is decoded to the string representation of an object in Javascript:
foffset=%5Bobject%20Object%5D
(URL encoded)foffset=[object Object]
(URL decoded)openapi-generator version
v4.0.0-beta2
As far as I can tell, there have been no relevant changes on
master
.OpenAPI declaration file
Command line used for generation
openapi-generator generate -g typescript-fetch -i ./test.openapi.yml -o api/
Steps to reproduce
type: object
.typescript-fetch
client code.additionalProperties
variant fails here).Related issues/PRs
Possibly related to PR #569 and Issue #802.
Suggest a fix
I'm working on a first pull request.
The idea is to allow nested
HTTPQuery
objects that are recursively serialized.The text was updated successfully, but these errors were encountered: