oapi-codegen
oapi-codegen copied to clipboard
feat: implement x-oapi-codegen-middlewares (#461)
This change adds the x-oapi-codegen-middlewares extension tag for the chi server and a new TaggedMiddleware field to the server interface. This makes it possible for users to define middlewares that are only called on specific endpoints, and also allows middlewares to be reused. The middlewares are called after the global middlewares, and in the order they are defined.
This change is fully backwards compatible with all older versions of oapi-codegen, however one disadvantage to this is the silent failure when a tagged middleware was not found. Perhaps that can be changed in v2.
Closes #461
would be very useful great work! need any help ?
would be very useful great work! need any help ?
hey, this has already been implemented and further improved upon in a fork that myself and other people in the discord gophers community are maintaining. You can check it out at https://github.com/discord-gophers/goapi-gen
@hhhapz Did you found some temporary solution?