You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the moment, we only hack the entry info schemas to display e.g. sortable and unit fields for entry endpoints. Instead, we should probably create a customised BaseModel class that add these keys to every Field (see the pydantic docs).
This would allow the backend to behave differently for custom schema (e.g. disallowing sorting on fields that have sorting False) and will also make it much easier to leverage our pydantic models to populate these fields.
I'm having a play with this already for #276 and #277.
The text was updated successfully, but these errors were encountered:
Nevermind, it seem this is really easy just adding extra keys to Field directly, we just currently throw some of them away. We may need to take this approach for type if we want to use the type info from pydantic (and add some conversion to the standard optimade types).
At the moment, we only hack the entry info schemas to display e.g. sortable and unit fields for entry endpoints. Instead, we should probably create a customisedBaseModel
class that add these keys to everyField
(see the pydantic docs).This would allow the backend to behave differently for custom schema (e.g. disallowing sorting on fields that have sorting False) and will also make it much easier to leverage our pydantic models to populate these fields.I'm having a play with this already for #276 and #277.The text was updated successfully, but these errors were encountered: