Skip to content

Commit

Permalink
Fix examples bug for objects (#131)
Browse files Browse the repository at this point in the history
Pydantic auto coercision behaves incorrectly when using a list of dicts
which contain exactly 2 items. In this case, the list of dicts gets
incorrectly converted into a dictionary.

Fix for: #130
  • Loading branch information
eyurtsev authored Apr 20, 2023
1 parent 29f8fe7 commit 409e048
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion kor/examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


class SimpleExampleAggregator(AbstractVisitor[List[Tuple[str, str]]]):
"""Use to visit node and all of its descendents and aggregates all examples."""
"""Use to visit node and all of its descendants and aggregates all examples."""

def visit_option(self, node: "Option", **kwargs: Any) -> List[Tuple[str, str]]:
"""Should not visit Options directly."""
Expand Down
2 changes: 1 addition & 1 deletion kor/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ class Object(AbstractSchemaNode):
Tuple[
str,
Union[
Mapping[str, Any],
Sequence[Mapping[str, Any]],
Mapping[str, Any],
],
]
] = tuple()
Expand Down

0 comments on commit 409e048

Please sign in to comment.