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

Improving the validator

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

Nobody has claimed this yet.

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

Description

One of the discussions at the workshop was about improving the server validator, given that it currently just checks that endpoints exist and return valid responses, and that filters do not return errors provided they are valid against the specification. We also need to make the validator much more flexible and modular.

One suggestion to really validate an implementation is to run the validator in an exploratory way, by:

  • running a general query on an endpoint, e.g. ?filter=nsites<n, increasing n until there are at least some results.
  • from the results of the initial query, first check that they all actually obey the filter provided, and then look at the differences between entries and try to construct other queries/conditions on the filter that should return a set of different results. e.g. ?filter=nsites<n AND elements HAS <element found in initial query>.

Using this approach, several features of the filter language can be tested, entries themselves can be validated, and the entries that are returned can be manually verified against the constructed filters.

This approach was partially implemented in #417. Still the following issues remain:

  • Query tests on dictionary and timestamp field types (we don't actually have timestamps implemented anyway)
  • Query combination with AND and OR
  • Query negation with NOT
  • Queries with optional operators like HAS ONLY
  • Queries on relationships
  • Queries with KNOWN and UNKNOWN
  • Queries that test operator precedence...
  • Queries that test query parameters, e.g. api_hint and sorting
  • JSON responses to be used in the providers dashboard
  • Test that unknown fields return a 501

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 reading the partial exploratory validator implementation referenced in #417 and compare it with the remaining checklist in this issue. The work is done when the validator covers the listed query types, combinations, operators, relationships, precedence, and query parameters, while preserving the completed JSON-response and unknown-field checks.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, testing-qa
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.