Skip to content

Commit

Permalink
fix bug when object in json schema
Browse files Browse the repository at this point in the history
  • Loading branch information
phenobarbital committed Nov 1, 2022
1 parent 3bee8c4 commit 751d323
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions datamodel/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,7 @@ def schema(cls, as_dict: bool = False) -> Any:
}
elif isinstance(_type, ModelMeta):
t = 'object'
enum_type = None
ref = f"/schemas/{_type.__name__}"
sch = _type.schema(as_dict = True)
defs[name] = sch
Expand Down
2 changes: 1 addition & 1 deletion datamodel/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
__title__ = 'python-datamodel'
__description__ = ('simple library based on python +3.8 to use Dataclass-syntax'
'for interacting with Data')
__version__ = '0.1.4'
__version__ = '0.1.5'
__author__ = 'Jesus Lara'
__author_email__ = '[email protected]'
__license__ = 'BSD'
2 changes: 1 addition & 1 deletion examples/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class User(BaseModel):
"""Basic User Model for authentication."""

user_id: int = Column(required=False, primary_key=True, repr=False)
first_name: str = Column(required=True, max=254, label="First Name")
first_name: str = Column(required=True, max=254, label="First Name", pattern="^\w*$")
last_name: str = Column(required=True, max=254, label="Last Name")
email: str = Column(required=False, max=254, label="User's Email")
password: str = Column(required=False, max=16, secret=True, widget='/properties/password')
Expand Down

0 comments on commit 751d323

Please sign in to comment.