Body from `RequestValidationResult` not a dict anymore
Hi guys,
I upgraded openapi-core on my project to 0.6.0, and now when I get an instance of RequestValidationResult and try to access the request body, it's a Model instance now, and I can't get it easily transformed to a plain dictionary to be used elsewhere - for example with dacite.from_dict, which I'm also using together with openapi-core.
I could get the plain dict body from the Flask request instead, but it would be nice if I could keep using the result.body instead, as this leads to a better design - it makes it clear that the body was validated.
Any suggestions on how I should proceed? Can the library receive an implementation change so that it's easier to get the dict representation of the model? Or should I go on and use Flask's request object instead?
Thanks, Diogo
@diogobaeder Hi. I plan to add model factory as configuration option for now you can use result.body. __dict__ which returns all model parameters in dict.
Hey @p1c2u , thanks for the quick response :-)
That doesn't work for me, unfortunately... I tried it earlier today and it doesn't quite work because of nested models (__dict__ doesn't cast the items). For now I'm using request.json from Flask, as a clean workaround.
Cheers!
@p1c2u would RequestValidationResult be the model factory one can override?