-
Notifications
You must be signed in to change notification settings - Fork 2
template literalize #489
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
template literalize #489
Conversation
packages/oats/package.json
Outdated
| "lodash": "^4.17.20", | ||
| "openapi3-ts": "^3.0.0" | ||
| "openapi3-ts": "^3.0.0", | ||
| "prettier": "^2.8.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we use prettier internally to print typescript code
lautis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with the reasoning – at least currently the AST approach has been a bit flaky and would expect even more changes with TypeScript 7. Having prettier 2 as runtime dependency is a bit annoying, but as discussed in Slack, we can fix that relatively easily.
Remove dependency to typescript AST. The typescript AST is not very stable API and causes us to have to change oats for new ts versions. Instead we now generate the code using template strings. A bit less type safety but a lot less prone to breaking with ts versions.
This should not change the behaviour or the semantics of the generated code -- just generation and possibly whitespace. Note that the integration tests in /test have not been changed.
This pr also refactors type generation code to be more testable
For one major user of the code generation the resulting code is the same modulo newlines and trailing commas and handling of incorrectly defined objects schemas. That and all the integration tests passing give some confidence that the generation works.
todo