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

Merge group schema with route schema #697

Open
StrangeBytesDev opened this issue Jun 27, 2024 · 0 comments
Open

Merge group schema with route schema #697

StrangeBytesDev opened this issue Jun 27, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@StrangeBytesDev
Copy link

What is the problem this feature would solve?

Currently, values set in a group guard over overwritten if also defined in a route. For example:

new Elysia()
    .group(
        '/something'
        {
            response: {
                default: t.Object({message: t.String()})
            }
        },
        (app) => app
            .get('/hello', () => 'hello', {response: {200: t.String()})
    )

The response object for the "/hello" route will only contain the entry for the 200 response. If instead the response object was merged together, it'd be useful for adding default responses to a group. This would be especially useful for the "default" response which is really handy for handling errors.

What is the feature you are proposing to solve the problem?

Merge together the group guard response with the route defined response.

What alternatives have you considered?

No response

@StrangeBytesDev StrangeBytesDev added the enhancement New feature or request label Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant