elysiajs / elysia

Ergonomic Framework for Humans
https://elysiajs.com
MIT License
10.59k stars 226 forks source link

additionalProperties do not work in nested response objects #859

Open dtinth opened 1 month ago

dtinth commented 1 month ago

What version of Elysia is running?

1.1.17

What platform is your computer?

Darwin 24.0.0 arm64 arm

What steps can reproduce the bug?

Run on Stackblitz: https://stackblitz.com/edit/elysia-iqupsh?file=index.ts

new Elysia().get(
  '/',
  async () => {
    return { keys: [{ a: 1, b: 2 }] };
  },
  {
    response: t.Object({
      keys: t.Array(
        t.Object({ a: t.Number() }, { additionalProperties: true })
      ),
    }),
  }
)

This also happens on Bun.

What is the expected behavior?

{
  "keys": [
    {
      "a": 1,
      "b": 2
    }
  ]
}

What do you see instead?

{
  "keys": [
    {
      "a": 1
    }
  ]
}

Additional information

No response

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

No response