Skip to content

Commit

Permalink
Fix default_schema not being called
Browse files Browse the repository at this point in the history
  • Loading branch information
wyfo committed Oct 6, 2020
1 parent a5b827b commit f854074
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
10 changes: 5 additions & 5 deletions apischema/json_schema/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,11 @@ def _default_schema(cls: AnyType) -> Optional[Schema]:


def get_schema(cls: AnyType) -> Schema:
return (
Schema(get_annotations(cls), get_constraints(cls))
or _default_schema(cls)
or Schema()
)
annotations, constraints = get_annotations(cls), get_constraints(cls)
if annotations is not None or constraints is not None:
return Schema(annotations, constraints)
else:
return _default_schema(cls) or Schema()


@merge_opts
Expand Down
4 changes: 4 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.9.1

- Fix default_schema not being called

## 0.9

- Improve Optional handling in schema generation
Expand Down
6 changes: 4 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name="apischema",
version="0.9",
version="0.9.1",
url="https://github.com/wyfo/apischema",
author="Joseph Perez",
author_email="[email protected]",
Expand All @@ -17,7 +17,9 @@
long_description_content_type="text/markdown",
python_requires=">=3.6",
install_requires=["dataclasses==0.7;python_version<'3.7'"],
extras_require={"test": ["typing_extensions", "tox", "pytest", "sqlalchemy"]},
extras_require={
"test": ["typing_extensions", "tox", "pytest", "sqlalchemy", "pydantic"]
},
classifiers=[
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
Expand Down

0 comments on commit f854074

Please sign in to comment.