Closed Northernside closed 1 year ago
Got it, Elysia experimental has an internal breaking change for handling schema which I haven't updated the swagger plugin to match the latest version yet.
Updating to @elysiajs/swagger: ^0.5.0-beta.0
should fix your problem.
Thank you, this resolved my issue :) Though, the other one with the title and version isn't. Should I open another issue?
Oh, and also it seems like the scheme isn't loading?
I assume I came a little bit too late but if you still need to solve this, @Northernside:
For the "info" object, you need to nest it under "documentation".
const app = new Elysia().use(
swagger({
documentation: {
info: {
title: "Elysia Documentation",
version: "1.0.0",
description: "Development docs.",
},
..
For the schema, something like this:
app.get("/api", () => {
res.send("Hello World!");
},{
response: {
200: {
id: t.Number({
description: "Unique identifier.",
default: 666,
}),
name: t.String({
description: "Name of mercenary.",
default: "John Wick",
}),
},
},
detail: {
summary: `Gets details of all available mercenaries.`,
tags: ["Mercenaries"],
},
});
Ohh sorry for the late response. That's great, thank you! <3
When trying to access the swagger url, it greets me with the following error:
And then when going to the direct JSON endpoint it shows me this in the browser:
Though, this only happens when being on the
experimental
version fromelysia
. I need that version though, because of the other routing bug inlatest
👀 I don't know if I should report it here or in the other repository.Example Code:
Also, I don't know why, but the specified
title
andversion
aren't showing either within Swagger onelysia@latest
since a few weeks.