Closed PhillipsOwen closed 4 years ago
Pydantic and FastAPI do this, they treat key: None
as if key
were absent. I don't know that it's a problem really, as long as the client is prepared to deal with it. But there may be a way to change this behavior.
https://pydantic-docs.helpmanual.io/usage/exporting_models/
See exclude_unset
and/or exclude_none
.
the model exporting worked after some tweaking. however since the API specified the Message pydantic model it always reverted back to including the None keys.
the solution i chose was to use"response_model_exclude_none=True" in the post definition. e.g.
APP.post('/' + operation, response_model=Message, response_model_exclude_none=True)(log_exception(md.query))
the output of omnicorp-overlay returns a node with the property "curie": null.
not only is this bad json it should not even return properties that do not have a value.