Skip to content

Validate input config files #145

Description

@alexdewar

Currently the input config files aren't validated, meaning if fields are missing or of the wrong type then errors will either be silently ignored or the user will get a random KeyError or something further along in the processing pipeline.

There are a couple of ways we could validate input files:

  1. Write a JSON schema and then use a package like jsonschema to validate files on loading
  2. Use Pydantic

Both would work fine. Using Pydantic would involve rewriting the input config as a kind of dataclass though, whereas if you use a JSON schema you could just leave it in dict form, which will be a less intrusive change. That said, having the input config specified using type hints (as you do for Pydantic) also has its own advantages in terms of being able to statically check that the fields that are being used exist and are of the correct type (e.g. with mypy: #136).

If we do this, we should also write tests to check that all of the bundled configs validate correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions