-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from tofarr/use_injecty
Using Injecty instead of native DI
- Loading branch information
Showing
26 changed files
with
356 additions
and
308 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
from injecty import InjectyContext | ||
from marshy.marshaller.marshaller_abc import MarshallerABC | ||
|
||
from schemey.factory.any_of_schema_factory import AnyOfSchemaFactory | ||
from schemey.factory.array_schema_factory import ArraySchemaFactory | ||
from schemey.factory.dataclass_schema_factory import DataclassSchemaFactory | ||
from schemey.factory.datetime_factory import DatetimeFactory | ||
from schemey.factory.enum_schema_factory import EnumSchemaFactory | ||
from schemey.factory.external_type_factory import ExternalTypeFactory | ||
from schemey.factory.factory_schema_factory import FactorySchemaFactory | ||
from schemey.factory.impl_schema_factory import ImplSchemaFactory | ||
from schemey.factory.ref_schema_factory import RefSchemaFactory | ||
from schemey.factory.schema_factory_abc import SchemaFactoryABC | ||
from schemey.factory.simple_type_factory import ( | ||
BoolTypeFactory, | ||
IntTypeFactory, | ||
NoneTypeFactory, | ||
FloatFactory, | ||
StrFactory, | ||
) | ||
from schemey.factory.tuple_schema_factory import TupleSchemaFactory | ||
from schemey.factory.uuid_factory import UuidFactory | ||
from schemey.json_schema.ranges_validator import RangesValidator | ||
from schemey.json_schema.schema_validator_abc import SchemaValidatorABC | ||
from schemey.json_schema.timestamp_validator import TimestampValidator | ||
from schemey.schema_marshaller import SchemaMarshaller | ||
|
||
priority = 100 | ||
|
||
|
||
def configure(context: InjectyContext): | ||
context.register_impl(MarshallerABC, SchemaMarshaller) | ||
context.register_impls( | ||
SchemaFactoryABC, | ||
[ | ||
RefSchemaFactory, | ||
BoolTypeFactory, | ||
IntTypeFactory, | ||
NoneTypeFactory, | ||
FloatFactory, | ||
StrFactory, | ||
DatetimeFactory, | ||
UuidFactory, | ||
ArraySchemaFactory, | ||
TupleSchemaFactory, | ||
ExternalTypeFactory, | ||
DataclassSchemaFactory, | ||
EnumSchemaFactory, | ||
FactorySchemaFactory, | ||
ImplSchemaFactory, | ||
AnyOfSchemaFactory, | ||
], | ||
) | ||
|
||
context.register_impls( | ||
SchemaValidatorABC, | ||
[ | ||
RangesValidator, | ||
TimestampValidator, | ||
], | ||
) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +0,0 @@ | ||
from typing import Callable, Dict | ||
|
||
_custom_validators = {} | ||
|
||
|
||
def register_custom_json_schema_validator(property_name: str, validator: Callable): | ||
_custom_validators[property_name] = validator | ||
|
||
|
||
def get_custom_json_schema_validators() -> Dict[str, Callable]: | ||
return _custom_validators | ||
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.