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

Automatically assign default values on requests #2005

Open
alfechner opened this issue Nov 25, 2024 · 2 comments
Open

Automatically assign default values on requests #2005

alfechner opened this issue Nov 25, 2024 · 2 comments
Labels
documentation PR welcome We would welcome and review a PR addressing this issue

Comments

@alfechner
Copy link
Contributor

From the docs:

Connexion will not automatically pass in the default values defined in your requestBody definition, but you can activate this by configuring a different RequestBodyValidator.

That sounds like a design decision. May I asked why this decision was made?

If it's just not implemented yet, would you be open for a PR?

@RobbeSneyders
Copy link
Member

Hi @alfechner,

This is indeed a conscious decision. The reason not to do this by default, is because it requires us to intercept the request body in middleware, modify it, and replay it to the application. This can lead to some issues, such as oom due to loading binary files in the body into memory.

We do provide an implementation which should work for most applications, and which is explained on the page the snippet you quoted links to. I would be better to link to this section directly though, so I would be happy with a PR to update this in the docs.

@RobbeSneyders RobbeSneyders added documentation PR welcome We would welcome and review a PR addressing this issue labels Nov 27, 2024
@alfechner
Copy link
Contributor Author

I understand, thanks for explaining.

Wouldn't it make sense to have it enabled for json media types, though? The binary oom issue would only apply to binary type I guess. Form data would read the files into memory anyway (remember this discussion?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation PR welcome We would welcome and review a PR addressing this issue
Projects
None yet
Development

No branches or pull requests

2 participants