-
Notifications
You must be signed in to change notification settings - Fork 3
Update all dependencies and split into packages #10
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
Conversation
that were introduced by openapi-ts codegen
to also fix issues with not being able to target custom errors with instanceof
… types error like Error: unknown format "date-time" ignored in schema at path
|
@alabs-tomscholz in the linked PR you were saying something about remaining bugs, which ones are that? |
|
The one I can think of, I fixed in 1d01b4b |
|
@henhal could you take a look? We'd love to go back to upstream from our fork. |
|
|
||
| export abstract class ApiError extends Error { | ||
| protected constructor(readonly request: RawRequest, message?: string) { | ||
| super(message); |
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.
Why was this line removed? It's simply so that sub-classes of this error are named properly, causing logs to show e.g. BadRequestError: some message instead of Error: some message
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.
It was my understanding that newer javascript targets (ES6 and up) no longer need this.
And we rely on a newer feature anyways here (the cause for wrapping exceptions), so I think there is no gain in having this backwards compatible.
But open to change any of this.
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.
I checked my expectations... and they were wrong. Logging the error name indeed spelled Error. So I put the line back in. I guess we can still only get rid of half of the hacks (the prototype chain) even in modern JavaScript, which baffles me.
|
Hi @luqasn Again, sorry for the slow response here. That daytime job just keeps coming in between. :) The very first version of this library was openapi-ts-backend, but it was later split into @openapi-ts/typegen, @openapi-ts/backend and @openapi-ts/request-types. And now, I guess @openapi-ts/cli is also being extracted to a separate package? |
so that logging them shows the proper subtype
|
No worries, life can be busy. |
|
@henhal are you still interested in the changes? |
|
Again, sorry for being a 🐌 . Also: no CI set up for this (yet, at least) |
|
Hey, great to see you :) #12 is awaiting upstream review and release, so I'd hold on that one. #13 can go in no problem, very minor additional option. #11 is a breaking change (handler return value shape changed). It can also go into the next release, but I'd do a 4.0 then. |
First of all: awesome library! As proponents of type-safe, schema-first development, we couldn't find any alternative to your great project that could provide us with that. Thanks!
We were trying to use an OpenAPI feature that was not supported by the openapi-typescript version this project originally used (#refs to other files). So we bumped "all the things" and fixed what needed fixing.
One of the things that we struggled with as non-guru-level node developers was invoking the cli because of all the some package.json setup with
moduleand what-not. So we split up the project into several packages, which we liked anyways from an architectural perspective.Note that this means you'd have to create a new npm package for the cli itself and the README would need to be adjusted for the codegen part if you decide to keep this.
If you want, I can adjust the README if you like the change and want to keep it.
Supersedes #9