Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schema Duplication in Query, Params, Cookie, and Headers Instead of Using $ref #1136

Open
Necrelox opened this issue Mar 20, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@Necrelox
Copy link

What version of Elysia is running?

1.2.25

What platform is your computer?

Linux 6.13.7-2-cachyos x86_64 unknown

What steps can reproduce the bug?

new Elysia()
    .model({
        example: t.Object({
            example: t.String()
        })
    })
    .get('/', () => ({ example: '' }), {
        query: 'example', // Duplicate ❌
        params: 'example', // Duplicate ❌
        headers: 'example', // Duplicate ❌
        cookie: 'example', // Duplicate ❌
        body: 'example', // $ref ✅
        response: 'example' // $ref ✅
    });

What is the expected behavior?

new Elysia()
    .model({
        example: t.Object({
            example: t.String()
        })
    })
    .get('/', () => ({ example: '' }), {
        query: 'example', // $ref ✅
        params: 'example', // $ref ✅
        headers: 'example', // $ref ✅
        cookie: 'example', // $ref ✅
        body: 'example', // $ref ✅
        response: 'example' // $ref ✅
    });

What do you see instead?

When using models in query, params, cookie, and headers via .model, they are redefined directly instead of being referenced with $ref.

Additional information

No response

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

yes

@Necrelox Necrelox added the bug Something isn't working label Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant