use populate_by_name=True in BaseModel#46168
Conversation
|
We can either fix this using model_validator or only update which one looks better, @pierrejeambrun , @bugraoz93 |
Thanks for bringing this up! Model Validator approach seems better in this context. I think the implementation of the endpoints shouldn't intervene datamodels in the ideal scenario. |
At least in the ConnectionBody case, yeah. we can def just use |
pierrejeambrun
left a comment
There was a problem hiding this comment.
Can't we just dump using by_alias=True ?
That won't work because of connection_id having serialization alias as |
|
Do you mind highlighting the code snipped that is causing problem ? Can't we |
Didn't notice
Here we have connection_id with serialization_alias set to |
I don't know. I don't think we need that in the base model yet. (edited: if the CI is happy with it lets do that)
I was talking about the usage of the model that is causing an issue (in the routes I guess), like where is that a problem ?
I didn't get that. Do you see an error ? |
1d6ea11 to
2f5cfbf
Compare
when we use by_alias=True, it throws the following error. Because, |
After thinking about above, I think its irrelevant |
…AIP-84/connections/patch_connection
|
#46245 should fix unrelated test failures |
…AIP-84/connections/patch_connection
related to ##44306
When working on #44306, noticed that we are dumping the model data and recreating ConnectionBody. But, issue here is that we dump the model data, output data will have "schema_". when this is passed to the ConnectionBody, its considered as a new filed and is ignored. Resulting,
schema_to be None. this PR fixes it by updating data using model_validator