Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add configuration schemas #90

Closed
wants to merge 4 commits into from
Closed

Conversation

maxfischer2781
Copy link
Member

@maxfischer2781 maxfischer2781 commented Mar 25, 2021

This PR adds schemas for configuration validation.

  • plugins can define schemas
  • configuration is verified by schema if defined
  • errors report useful information on the config
  • cobald configuration defines a schema
  • documentation on how to define a schema
  • change fragment

Also adds documentation to most of the existing configuration backend. Hopefully, this makes it slightly less arcane.

Closes #84.

@maxfischer2781
Copy link
Member Author

@giffels The current plan is to have the cobald.daemon.plugins.constraints define a (pydantic) schema for the entire plugin:

@plugin_constraints(required=True, schema=cobald_schema)
def load_pipeline(content: list):
    ...

It might be useful to allow schemas for yaml_constructors as well – that would make it easier to gradually add schemas "inside" a config, and free the plugin-wide schema from covering every case. Should I add it as well?

@maxfischer2781
Copy link
Member Author

Closing this for the time being. With the current feature set, there isn't really any advantage over plugins just doing their own validation. Adding more meaningful features (e.g. precise configuration warnings) would be a too significant change right now.

This should be worth to revisit once the core library has been cleaned up and streamlined more.

@maxfischer2781 maxfischer2781 deleted the feature/config-schema branch January 17, 2024 15:02
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.

Add programmatic configuration schemas
1 participant