Skip to content

Configuration schema and validation - #139

Merged
victorlin merged 2 commits into
masterfrom
victorlin/config-schema
Aug 11, 2026
Merged

Configuration schema and validation#139
victorlin merged 2 commits into
masterfrom
victorlin/config-schema

Conversation

@victorlin

@victorlin victorlin commented Aug 11, 2026

Copy link
Copy Markdown
Member

Description of proposed changes

Adds a YAML schema file for the structure of the current 'config' variable and uses it for validation on the variable at the start of the workflow.

Date values in the default config file are explicitly quoted to avoid being parsed into Python as date objects by Snakemake's YAML parser.

Related issue(s)

nextstrain/public#46

Checklist

  • Checks pass
  • Add changelog
  • Update changelog

For consistency with other pathogen repos.
Comment thread config.schema.yaml
Comment on lines +48 to +49
conda_environment:
type: string

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non-blocking

Just noticed this conda_environment param isn't used in the workflow at all. I wish there was a way for us to validate the schema against the workflow to flag things like this.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, schema can get out of sync with actual usage. There are ways to programmatically find and track every usage of the config variable and compare that against the schema, but the complexity doesn't seem worthwhile.

I'll leave it as-is in this PR.

Comment thread config/configfile.yaml
resolutions:
all-time:
min_date: 1975-01-01
min_date: "1975-01-01"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Date values in the default config file are explicitly quoted to avoid
being parsed into Python as date objects by Snakemake's YAML parser.

OH! That's good to know.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It hasn't mattered so far because the date objects get translated back to the same YYYY-MM-DD strings in augur filter --min-date {params.min_date}.

In augur subsample, we explicitly parse date-like values into Python as strings.

Adds a YAML schema file for the structure of the current 'config'
variable and uses it for validation on the variable at the start of the
workflow.

Date values in the default config file are explicitly quoted to avoid
being parsed into Python as date objects by Snakemake's YAML parser.
@victorlin
victorlin force-pushed the victorlin/config-schema branch from f154019 to 5433a62 Compare August 11, 2026 23:45
@victorlin
victorlin merged commit f3c88eb into master Aug 11, 2026
3 checks passed
@victorlin
victorlin deleted the victorlin/config-schema branch August 11, 2026 23:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants