-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
[BUG][typescript-fetch] Schema with type array generates undefined function #3278
Comments
👍 Thanks for opening this issue! The team will review the labels and make any necessary changes. |
cc @TiFu |
Sorry for the annoying bump, but any movement on this one? @wing328 @macjohnny |
@dalinarkholin would you like to implement a fix for that? i can point you to the relevant files. |
@macjohnny Was this included in 4.1.0? I still see the same behavior. |
@dalinarkholin this should be inlcuded in 4.1.0 |
@macjohnny my mistake. This is resolved. |
thanks again to @someone1 for fixing this |
I'm still seeing this on 4.3.1. Here's a gist with a schema and the generated https://gist.github.com/markspolakovs/afd0bd3cdf6955a90fc1e75f60e166b1 |
@markspolakovs would you like to fix this issue? |
Any workaround possible for this issue? |
@markspolakovs did you try the latest master or stable version v5.0.1? What do the actual code and expected code look like? |
@wing328 Can still reproduce on v5.0.1, here's the input and output. On line 40 the generator outputs syntactically invalid TypeScript ( |
For me this happens when I use v5.0.0-beta3 onwards, but it looks fine when using v5.0.0-beta2. Is there any possible workaround? |
I'm seeing seemingly the same problem on v. 5.2.0 now: JsonAPI spec: ...
"included" : {
"type" : "array",
"description" : "...",
"items" : {
"oneOf" : [ {
"type" : "object"
}, {
"type" : "boolean"
}, {
"type" : "string"
}, {
"type" : "number"
} ]
}
}
... Typescript type looks like that: export interface V1BunnyBunnyId204409787 {
included?: Array<object | boolean | string | number>;
} And the generated return {
'included': !exists(json, 'included') ? undefined : ((json['included'] as Array<any>).map(object | boolean | string | numberFromJSON)),
}; |
Has anyone found any workaround? 6.2.1 and I see a lot of undefined functions like |
Facing the same issue here, shall post a workaround tho if I find one |
Any update in 2023? How is anyone using this generator if a simple |
If anyone would like to contribute a fix or sponsor a fix, please reply to let us know. |
Bug Report Checklist
Description
I'm generating a
typescript-fetch
client using OpenAPI Generator4.0.2
. After running the generator, functionstringToJSON
is included in the output, but it is not defined.openapi-generator version
4.0.2
OpenAPI declaration file content or url
Command line used for generation
Steps to reproduce
I've created a gist that should help to reproduce the issue.
You should see the following output:
The source of the error can be found in
src/apis/DefaultApi.ts
which contains the following:Related issues/PRs
#1877
Suggest a fix
Function
stringToJSON
should be added to generated file.The text was updated successfully, but these errors were encountered: