villebro commented on a change in pull request #18960:
URL: https://github.com/apache/superset/pull/18960#discussion_r815900588
##########
File path: superset/charts/api.py
##########
@@ -283,7 +283,7 @@ def post(self) -> Response:
return self.response_400(message=error.messages)
try:
new_model = CreateChartCommand(g.user, item).run()
- return self.response(201, id=new_model.id, result=item)
+ return self.response(201, id=new_model.id,
result=new_model.to_json())
Review comment:
Since the model is mutated on the command, we need to return the final
metadata, not the original one.
##########
File path: superset/charts/api.py
##########
@@ -354,7 +354,9 @@ def put(self, pk: int) -> Response:
return self.response_400(message=error.messages)
try:
changed_model = UpdateChartCommand(g.user, pk, item).run()
- response = self.response(200, id=changed_model.id, result=item)
+ response = self.response(
+ 200, id=changed_model.id, result=changed_model.to_json()
Review comment:
same here
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]