-
I am wondering if something like this is possible: expose the property on a 400 response that is normally called For my own validators, I am experimenting with pydantic's
So far, this appears to do what I am expecting. It exposes the validation properties as camelCase, while allowing me to keep my pythonic snake_case properties internally. There are a few things I have to do to make this work:
So far this looks good but then I have lingering things like the status_code on 400 responses or other public exceptions. From what I can tell, these don't really go through validation and the given properties are just coded into the HTTPException. So I'm not sure if there is really a straightforward way to change this. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Update. I guess point 3 above does not work like I thought. I suppose I would need to specify camel case path parameters. I don't see a way to specify a path parameter alias the way you can a query parameter. I was under the impression that the query property was overloaded for both, but I am seeing now that does not seem to be the case. |
Beta Was this translation helpful? Give feedback.
-
You can define a custom serializer on your response and modify the data there. |
Beta Was this translation helpful? Give feedback.
You can define a custom serializer on your response and modify the data there.