Skip to content

missing swagger route doc when using model[] in response #1147

Open
@vikyw89

Description

@vikyw89

What version of Elysia is running?

Latest version: 1.2.25 published 3 weeks ago

What platform is your computer?

ubuntu 24

What steps can reproduce the bug?

import { t } from "elysia";

export const todoSchema = t.Object({
  id: t.String(),
  createdAt: t.Date(),
  updatedAt: t.Date(),
  createdById: t.String(),

  //   data
  title: t.String(),
  description: t.Optional(t.String()),
  assignedAt: t.Optional(t.Date()),
  completedAt: t.Optional(t.Date()),

  //   relations
  SubtaskIds: t.Array(t.String()),
  ParentTaskIds: t.Array(t.String()),
});

export const todoRouter = new Elysia({ prefix: "/todos", tags: ["todos"] })
  .model({
    todo: todoSchema,
  })
  .get(
    "",
    (ctx) => {
      return [
        {
          id: "1",
          createdAt: new Date(),
          updatedAt: new Date(),
          createdById: "1",
          title: "Todo 1",
          description: "Description 1",
          assignedAt: new Date(),
          completedAt: new Date(),
          SubtaskIds: ["1", "2", "3"],
          ParentTaskIds: ["1", "2", "3"],
        },
      ];
    },
    {
      response: "todo[]",
      query: t.Object({
        userId: t.String(),
      }),
    }
  );

add swagger plugin and check the route documentation, it's missing

What is the expected behavior?

No response

What do you see instead?

No response

Additional information

No response

Have you try removing the node_modules and bun.lockb and try again yet?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions