connexion icon indicating copy to clipboard operation
connexion copied to clipboard

Reintroduce header param type conversion

Open CordulaGuder opened this issue 1 year ago • 1 comments

This PR fixes the type conversion of header params that seems to have gone missing during the refactoring.

In Connexion 2, the ParameterValidator used to do type conversion in its main function validate_parameter, so it did that for all kinds of params it came across. In Connexion 3, this has moved to the URIParser classes (connexion.uri_parsing), so header params are not being type converted anymore. This PR fixes this bug.

Changes proposed in this pull request:

  • add type conversion to validate_header_parameter in ParameterValidator

CordulaGuder avatar May 22 '24 11:05 CordulaGuder

Thanks @CordulaGuder,

We explicitly deduplicated all coerce_type calls during the refactoring and moved them into the uri_parser so it is done in a single place. I indeed see that this misses the headers.

However by implementing it in the validation, the types in the headers are validated after coercion while they are passed to the application without coercion. If we want to reactivate this, we should centralize it as well. We can either also do it in the URIParser, although I'm not sure if that makes sense, or in the ConnexionRequest class.

See #1934 which was triggered by reviewing this PR.

RobbeSneyders avatar May 27 '24 11:05 RobbeSneyders