Skip to content

Commit 1ac16f1

Browse files
Bump pydantic-yaml from 0.11.2 to 1.1.1 (#633)
* Bump pydantic-yaml from 0.11.2 to 1.1.1 Bumps [pydantic-yaml](https://github.com/NowanIlfideme/pydantic-yaml) from 0.11.2 to 1.1.1. - [Release notes](https://github.com/NowanIlfideme/pydantic-yaml/releases) - [Commits](NowanIlfideme/pydantic-yaml@v0.11.2...v1.1.1) --- updated-dependencies: - dependency-name: pydantic-yaml dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> * Migrate code to v1 * Linting --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Mathieu Leplatre <[email protected]>
1 parent 4943a11 commit 1ac16f1

File tree

5 files changed

+109
-37
lines changed

5 files changed

+109
-37
lines changed

jbi/configuration.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from functools import lru_cache
66

77
from pydantic import ValidationError
8+
from pydantic_yaml import parse_yaml_raw_as
89

910
from jbi import environment
1011
from jbi.models import Actions
@@ -26,7 +27,9 @@ def get_actions() -> Actions:
2627
def get_actions_from_file(jbi_config_file: str) -> Actions:
2728
"""Convert and validate YAML configuration to `Action` objects"""
2829
try:
29-
actions: Actions = Actions.parse_file(jbi_config_file)
30+
with open(jbi_config_file, encoding="utf8") as file:
31+
content = file.read()
32+
actions: Actions = parse_yaml_raw_as(Actions, content)
3033
return actions
3134
except ValidationError as exception:
3235
logger.exception(exception)

jbi/models.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from urllib.parse import ParseResult, urlparse
1313

1414
from pydantic import BaseModel, Extra, Field, validator
15-
from pydantic_yaml import YamlModel
1615

1716
from jbi import Operation, steps
1817
from jbi.errors import ActionNotFoundError
@@ -76,7 +75,7 @@ class ActionParams(BaseModel):
7675
issue_type_map: dict[str, str] = {"task": "Task", "defect": "Bug"}
7776

7877

79-
class Action(YamlModel):
78+
class Action(BaseModel):
8079
"""
8180
Action is the inner model for each action in the configuration file"""
8281

@@ -92,7 +91,7 @@ def jira_project_key(self):
9291
return self.parameters.jira_project_key
9392

9493

95-
class Actions(YamlModel):
94+
class Actions(BaseModel):
9695
"""
9796
Actions is the container model for the list of actions in the configuration file
9897
"""

0 commit comments

Comments
 (0)