[BUG] openapi-nodegen-api-file.yml parsing issues on MacOs
Closed this issue · 5 comments
Describe the bug
There seems to be a parsing issue for the generated openapi-nodegen-api-file.yml
file on MacOS.
It produces the following error when running the app:
Promise {
<rejected> [ParseException [Error]: Unexpected characters (
}
},
"servers": [
{
"url": "{protocol}://{host}:{port}",
"variables": {
"host": {
"default": "localhost"
},
The error is fixed by just resaving the file.
To Reproduce
Steps to reproduce the behavior:
- Generate the backend from a swagger file with
generate-ti
- Start the application
Expected behavior
The application rune without issue.
Node & NPM version
Node: 12.18.2
NPM: 6.14.8
Operating system:
- OS: MacOS
- Version: 11.2.2
Additional context
The error is fixed by just resaving the file.
That's really strange. If it's easily reproducible, that's good at least.
That yaml file is just the duplicated output of the input yml, so I don't think the core reads it for anything. Does the whole generation stop when you see this error, or only when you start the server? Which template are you using for the server generation?
It's not the generation but when running the API with swaggerUI enabled.
ok that sounds very strange but then not an issue with the core perhaps?
Sounds the issue could be located around about here:
https://github.com/acrontum/generate-it-typescript-server/blob/master/src/http/nodegen/routes/swaggerRoutes.ts#L12
Could you confirm please @celleb a more detailed jounrey up to when you see this happen please, also as it doesn't happen on generation i would vote this issue be moved to the typescrpt server repo too.
@celleb as this happens on runtime of a specific set of templates, i will close this ticket unless you have any objections?
Just so we don't forget that this might still be an issue, moved it into the template.
We have very few people testing on mac, so it will be a difficult issue to nail down and debug. It seems fairly low prio (albeit mildly annoying), but I think we should keep a note of it somewhere