incorrect work with type recursion
Opened this issue · 0 comments
ilyhalight commented
If we set the response type as an object containing recursion, an error occurs when opening the endpoint in swagger (and incorrect types are displayed in the example), while scalar stops working altogether.
Full code example:
import { Elysia, t } from "elysia";
import { swagger } from "@elysiajs/swagger";
const app = new Elysia()
.use(
swagger({
provider: "swagger-ui", // scalar doesn't work bruh
path: "/docs",
documentation: {
info: {
title: "test",
version: "1.0.0",
},
tags: [
{ name: "App", description: "General endpoints" },
{ name: "Users", description: "User endpoints" },
],
},
})
)
.get(
"/test",
() => {
return {
test: "321",
part: {
test: "32133",
},
};
},
{
response: {
200: t.Recursive((This) =>
t.Object({
test: t.String(),
part: t.Optional(This),
})
),
},
}
)
.listen({
port: 3000,
hostname: "0.0.0.0",
});
console.log(
`🦊 Elysia is running at ${app.server?.hostname}:${app.server?.port}`
);