kibble-1
kibble-1 copied to clipboard
Introduce DataSource class
Description Currently all data sources supported by Kibble are defined in this one, long yaml: https://github.com/apache/kibble/blob/8904f39ca2b19aef3522455ec357294cc398c49e/kibble/api/yaml/sourcetypes.yaml#L1-L103
We should introduce DataSource
base class and then rewrite (automatically) the yaml file into pythonic code. For example:
class GitDataSource(DataSource):
title: str = "Plain git repository"
description: str = "This is a plain git repository with no issues/PRs attached. For GitHub repositories, use the GitHub source type."
regex: str = r"(?:https?|git)://.*/.+\.git"
example: str = "git://example.org/repos/foo.git"
optauth: List[str] = [
"username",
"password",
]
This will also bring us closer to refactoring API - having a DataSource
class we can implement common update, delete, create methods that will be used by /api/sources
endpoint.
Use case To make it easier to work with data sources and keep them as pythonic object not yaml files.
Related Issues N/A