Skip to content

Commit

Permalink
Merge pull request #8 from eadwinCode/factory_fi
Browse files Browse the repository at this point in the history
Factory Refactor
  • Loading branch information
eadwinCode committed Sep 16, 2023
2 parents 7e47fbf + 5cbfda6 commit ffe8910
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ninja_schema/orm/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
from .model_schema import ModelSchema
from .schema import Schema

__all__ = [
"SchemaFactory",
]
__all__ = ["SchemaFactory"]


class SchemaFactory:
Expand All @@ -40,6 +38,7 @@ def create_schema(
fields: Optional[List[str]] = None,
exclude: Optional[List[str]] = None,
skip_registry: bool = False,
optional_fields: Optional[Union[str, List[str]]] = None,
) -> Union[Type["ModelSchema"], Type["Schema"], None]:
from .model_schema import ModelSchema

Expand All @@ -49,7 +48,7 @@ def create_schema(
raise ConfigError("Only one of 'include' or 'exclude' should be set.")

schema = registry.get_model_schema(model)
if schema:
if schema and not skip_registry:
return schema

model_config_kwargs = {
Expand All @@ -59,6 +58,7 @@ def create_schema(
"skip_registry": skip_registry,
"depth": depth,
"registry": registry,
"optional": optional_fields,
}
cls.get_model_config(**model_config_kwargs) # type: ignore
new_schema = (
Expand Down

0 comments on commit ffe8910

Please sign in to comment.