-
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.
Merge pull request #1364 from DSD-DBS/pydantic-config-template
feat: Convert config template to pydantic model
- Loading branch information
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.