(Using openapi-ts version 0.52.9 "@hey-api/openapi-ts": "~0.52.0")
Weird problem to have run into, but I've currently got a monorepo setup (using Rush) where one of my packages uses openapi-ts to generate a client. We don't commit our generated client and instead generate it each time the pipeline runs, then use that generated code to run tests and build everything.
Everything works perfectly fine when I'm running everything locally, but for some reason when the openapi-ts command is run in our GitLab pipeline, it generates a borked types.gen.ts where some of the Response data types (interfaces) have a closing parenthesis that causes syntax errors. I discovered this while I was running my test command and got the following error:
Error: Transform failed with 1 error:
/builds/<company>/<project>/website/apps/@<company>/<package-name>/src/<ClientFolderName>/types.gen.ts:1195:1: ERROR: Unexpected ")"
I was confused why it was getting that error because when I checked that line locally there was no ) character. But then I went into the job's artifacts and downloaded its types.gen.ts file and saw the following plain as day:
Do you have any idea what might be causing this parenthesis? The above Response data type is not the only one to have this problem. A ctrl+F in types.gen.ts is giving 83 instances of this error, and they are all typescript interfaces with the suffix Response in their name, indicating they are all types generated by a defined schema in the openapi.json file associated with the output of a particular endpoint.
I want to stress again I do not see this problem locally, so there must be some kind of weird environment or config problem while the code is running in the gitlab pipeline, but I have no idea where to look to get any information about the root cause. Any ides?
Description
(Using openapi-ts version 0.52.9
"@hey-api/openapi-ts": "~0.52.0"
)Weird problem to have run into, but I've currently got a monorepo setup (using Rush) where one of my packages uses openapi-ts to generate a client. We don't commit our generated client and instead generate it each time the pipeline runs, then use that generated code to run tests and build everything.
Everything works perfectly fine when I'm running everything locally, but for some reason when the
openapi-ts
command is run in our GitLab pipeline, it generates a borkedtypes.gen.ts
where some of the Response data types (interfaces) have a closing parenthesis that causes syntax errors. I discovered this while I was running my test command and got the following error:I was confused why it was getting that error because when I checked that line locally there was no
)
character. But then I went into the job's artifacts and downloaded its types.gen.ts file and saw the following plain as day:Notice the closing parenthesis at the end, as if this were supposed to be a
type
declaration but the second paren wasn't removed.For context, here is an excerpt from the openapi.json input file that shows the related endpoint:
And here's that NotificationSourceInfo schema from the same file:
And here's my openapi-ts.config.ts (the generate command was run without any options, simply
openapi-ts
):Big Question
Do you have any idea what might be causing this parenthesis? The above Response data type is not the only one to have this problem. A ctrl+F in types.gen.ts is giving 83 instances of this error, and they are all typescript interfaces with the suffix
Response
in their name, indicating they are all types generated by a defined schema in the openapi.json file associated with the output of a particular endpoint.I want to stress again I do not see this problem locally, so there must be some kind of weird environment or config problem while the code is running in the gitlab pipeline, but I have no idea where to look to get any information about the root cause. Any ides?
Reproducible example or configuration
https://stackblitz.com/edit/hey-api-client-fetch-example
OpenAPI specification (optional)
No response
System information (optional)
No response