-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Convert config template and schema to Pydantic model
Co-authored-by: MoritzWeber0 <[email protected]>
- Loading branch information
1 parent
d6decd0
commit 66728d2
Showing
45 changed files
with
694 additions
and
708 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ | |
|
||
.idea | ||
config/* | ||
!config/config_template.yaml | ||
.history | ||
**/__pycache__/ | ||
.vscode | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,10 @@ | ||
# SPDX-FileCopyrightText: Copyright DB InfraGO AG and contributors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
from . import generate, loader, models | ||
|
||
import logging | ||
if not loader.does_config_exist(): | ||
generate.write_config() | ||
|
||
import jsonschema | ||
import jsonschema.exceptions | ||
|
||
from . import exceptions, loader | ||
|
||
log = logging.getLogger(__name__) | ||
config = loader.load_yaml() | ||
|
||
|
||
def validate_schema(): | ||
config_schema = loader.load_config_schema() | ||
try: | ||
jsonschema.validate(config, config_schema) | ||
except jsonschema.exceptions.ValidationError as error: | ||
raise exceptions.InvalidConfigurationError( | ||
f"{error.__class__.__name__}: {error.message}", | ||
) from None | ||
config = models.AppConfig(**loader.load_yaml()) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.