Skip to content

Add schema, validation for custom prompt YAML files #40

@falquaddoomi

Description

@falquaddoomi

(Suggested by @miltondp in #37 (comment))

In PR #37, the custom prompt YAML config files, ai_revision-config.yaml and ai_revision-prompts.yaml are currently ad-hoc validated by the code to look for specific keys and values. As suggested, it would be more robust to have the entire documents' schema described and validated at runtime.

I should mention that it's been a long time since I've done schema validation, but a quick look revealed a few options for schema validation in Python. All of them seem to use Python dictionaries as the common language between different serialization formats (JSON, YAML, etc.) which IMHO is a good idea. Here's the list, ordered by stars on GitHub:

Frankly, from a quick look they all seem very similar. My impression from their docs pages is that Cerberus would be the easiest to work with, so perhaps if there aren't other strong opinions we can just go with that, but I'm of course open to discussion.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions