Description
What version of Elysia is running?
1.3.1
What platform is your computer?
Linux Mint 22.1 - Linux 6.8.0-59-generic x86_64 x86_64
What steps can reproduce the bug?
You need to create two plugins with guard, which describe headers. Apply them to the route. The one that was previously included in the route will work.
import Elysia, { t } from "elysia";
const firstPlugin = new Elysia()
.guard({
as: 'scoped',
schema: 'standalone',
headers: t.Object({
accept: t.UnionEnum(['application/json', 'application/x-msgpack', '*/*'], {
default: '*/*'
})
})
}).as('scoped');
const secondPlugin = new Elysia()
.guard({
as: 'scoped',
schema: 'standalone',
headers: t.Object({
authorization: t.String({
pattern: '^(tma|auth_token) .*',
})
})
}).as('scoped');
const route = new Elysia()
.use(firstPlugin)
.use(secondPlugin)
.get('', ({ headers }) => {
return {
message: 'Hi, SaltyAom!'
}
});
What is the expected behavior?
It is expected that the types will be combined in the documentation based on the "standalone" logic
What do you see instead?
Everything is great in terms of code and hints from the editor, but the problems start with swagger. The types in guard are not combined there, or rather, they are not shown there, but everything functions in the application itself thanks to standalone. The documentation shows the types of the last plugin, that is, the headers of the first plugin overlap with the headers of the second plugin.
Additional information
As I understand it, this plugin is not yet friendly with mixing types. It needs an update
Have you try removing the node_modules
and bun.lockb
and try again yet?
I tried, but as mentioned above, the problem is that the plugin is incompatible with the Elysia 1.3.1/1.3.0 version.