Materials-Consortia / Materials-Consortia/optimade-python-tools

Shift more validation into the OpenAPI schema

Open
#709 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement models OpenAPI priority/medium
Dominant language
Python
Stars
91
Forks
54
PR merge metrics
No merged PRs in 30d

Description

Some places where we could do this (please add):

  • regexps for chemical formulae (#708)
  • defining an elements type to constrain strings/arrays involving elements (e.g. the elements field, species_at_sites etc.)
  • provider validation should have patterns in the OpenAPI schema (#723)

Slight misdirection but there are quite a few other places that we could consider embedding validation into the OpenAPI, e.g. elements which is currently just an array of strings, could instead be an array of Elements, i.e. strings that match the regexp/enum.

Originally posted by @ml-evs in https://github.com/Materials-Consortia/optimade-python-tools/issues/708#issuecomment-780497285

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the OpenAPI schema and reviewing how the existing chemical-formula and provider patterns were added. Investigate the unchecked elements type and its uses in fields such as elements and species_at_sites; done means the relevant schema constraints are defined and covered by the project’s validation checks.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, python
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.