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

Constraining list/array types in the schema #55

Closed
ml-evs opened this issue Jun 25, 2019 · 1 comment · Fixed by #166
Closed

Constraining list/array types in the schema #55

ml-evs opened this issue Jun 25, 2019 · 1 comment · Fixed by #166
Labels
priority/high Issue or PR with a consensus of high priority schema Concerns the schema models

Comments

@ml-evs
Copy link
Member

ml-evs commented Jun 25, 2019

I don't have time for a full explanation (perhaps @ltalirz/@dwinston can elaborate), but we still have issues in constraining e.g. the lengths of lists in a way that is compatible with both pydantic and FastAPI.

Currently we have conlist which has just been released in pydantic, but has no effect on the generated API pydantic/pydantic/issues/604. It is not clear whether the types inside the conlist can be constrained, as of yet.

We also need a way to constrain lists of lists, e.g. ensuring lattice vectors are always 3x3, and if possible, constraining e.g. cartesian_site_positions to have length nsites, in order to fully validate a JSON response against the spec.

Some additional discussion can be found in the comments to #45.

@ltalirz
Copy link
Member

ltalirz commented Jun 28, 2019

@ml-evs @dwinston fastapi 0.31.0 has just been released and should be compatible with pydantic 0.29

This (hopefully) brings us a working conlist implementation.

@ml-evs ml-evs added the schema Concerns the schema models label Jun 30, 2019
@CasperWA CasperWA added the priority/high Issue or PR with a consensus of high priority label Feb 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority/high Issue or PR with a consensus of high priority schema Concerns the schema models
Projects
None yet
3 participants