canonical / github-profiles-automator

Github profiles automator charm
Apache License 2.0
0 stars 0 forks source link

Refactor the config validation logic #44

Open kimwnasptd opened 1 week ago

kimwnasptd commented 1 week ago

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)

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
syncronize-issues-to-jira[bot] commented 1 week ago

Thank you for reporting your feedback to us!

The internal ticket has been created: https://warthogs.atlassian.net/browse/KF-6884.

This message was autogenerated