Skip to content

Commit

Permalink
bump pydantic version
Browse files Browse the repository at this point in the history
  • Loading branch information
apatrushev committed Oct 18, 2023
1 parent 25b6061 commit b12ee6b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dynamic = ["version"]

dependencies = [
"janus",
"pydantic<2",
"pydantic>=2.4.1,<2.5",
]

classifiers = [
Expand Down
8 changes: 1 addition & 7 deletions src/aioflows/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,19 +147,13 @@ def __ge__(self, other):
@property
def options(self):
if hasattr(self, 'Options'):
options = pydantic.tools.schema_of(self.Options)
options = pydantic.TypeAdapter(self.Options).json_schema()
return (self.options_cleanup(options, self),)
return ()

@staticmethod
def options_cleanup(options, obj=None):
options = copy.deepcopy(options)
options.pop('$ref', None)
options.pop('type', None)
options.pop('title', None)
definitions = options.pop('definitions', None)
if definitions is not None:
options['properties'] = definitions['Options']['properties']
for k, v in options['properties'].items():
if obj is not None and hasattr(obj.config, k):
v['default'] = getattr(obj.config, k)
Expand Down

0 comments on commit b12ee6b

Please sign in to comment.