-
Notifications
You must be signed in to change notification settings - Fork 0
Conversation
if (req.headers.authorization) { | ||
next() | ||
} else { | ||
res.status(401).json({ error: { message: "unauthorized" }}) |
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.
Ideally the library user doesn't want to do this, but instead generate an error e.g.
new ServerUnauthorizedError({ typedPayload: '' })
that contains the possible error codes and response bodies defined in the swagger schema.
Can we showcase this somehow? Maybe we need to extend some of the type generation things for that?
I think the only response that is not in the swagger schema and still allowed is 500 with an empty response body.
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.
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 think that's the part we actually need to implement for this, so let's do it the next time! :)
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.
Yeah. We have to generate those types if declared in OpenAPI file. Will work on that!
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.
FYI these types are generated now :)
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.
🥇 niceee!
@aimed this is appearing in my pull requests for a while. decided that it was the time to ask: shall we do this or can I close it? are you actively supporting the project? |
@rodmatos AHAHAH I just found it there too, this can be closed 🤗 |
This pull request includes the integration between OpenAPI's
security
functionality and a client provided middleware that is executed on the routes that were marked withsecurity
.Please refer to the docs/README.md for any usage questions.