canonical / canonical/github-profiles-automator

Refactor the config validation logic

Open
#44 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
1
Forks
2
Avg merge
1d 11h
Merged PRs (30d)
4

Description

### Context

As of right now we have 2 different functions for validating different parts of the config values:
1. For checking if the ssh relevant configs are valid (i.e. no non-empty `repository, valid ssh url)
2. For checking if the principals config values are not empty

The above though should be refactored, as there are currently mechanisms in place for better structure.

Two potential approaches to go with:
1. Using `pydantic` for validating the config options, which is what the Data Platform is doing
2. Use a dedicated component (from [Chisme's BaseCharm](https://github.com/canonical/charmed-kubeflow-chisme/tree/main/src/charmed_kubeflow_chisme/components))

This came also up during https://github.com/canonical/github-profiles-automator/pull/39#discussion_r1941404706

### What needs to get done

1. Commit in which approach we want (pydantic vs component, or both)
2. Refactor and remove the current functions for validating the config

### Definition of Done

1. We no longer use functions for validation, but use either components or pydantic
2. Have converted the unit tests to work with the updated code

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.