Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to add custom schema entries for unit/sortable (and eventually type) #278

Closed
ml-evs opened this issue May 26, 2020 · 1 comment
Closed
Assignees
Labels
schema Concerns the schema models

Comments

@ml-evs
Copy link
Member

ml-evs commented May 26, 2020

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.

@ml-evs ml-evs added the schema Concerns the schema models label May 26, 2020
@ml-evs ml-evs self-assigned this May 26, 2020
@ml-evs
Copy link
Member Author

ml-evs commented May 26, 2020

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).

@ml-evs ml-evs closed this as completed May 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
schema Concerns the schema models
Projects
None yet
Development

No branches or pull requests

1 participant