コード例 #1
0
    def _unmarshal(self, param_or_media_type, value, context):
        if not param_or_media_type.schema:
            return value

        from openapi_core.unmarshalling.schemas.factories import (
            SchemaUnmarshallersFactory, )
        unmarshallers_factory = SchemaUnmarshallersFactory(
            self.spec._resolver,
            self.custom_formatters,
            context=context,
        )
        unmarshaller = unmarshallers_factory.create(param_or_media_type.schema)
        return unmarshaller(value)
コード例 #2
0
 def create_unmarshaller(schema, custom_formatters=None, context=None):
     custom_formatters = custom_formatters or {}
     format_checker = build_format_checker(**custom_formatters)
     return SchemaUnmarshallersFactory(
         format_checker=format_checker,
         custom_formatters=custom_formatters, context=context).create(
             schema)
コード例 #3
0
 def schema_unmarshallers_factory(self):
     spec_resolver = self.spec.accessor.dereferencer.resolver_manager.\
         resolver
     return SchemaUnmarshallersFactory(
         spec_resolver, self.format_checker,
         self.custom_formatters, context=UnmarshalContext.RESPONSE,
     )
コード例 #4
0
ファイル: validators.py プロジェクト: correl/openapi-core
    def _unmarshal(self, param_or_media_type, value, context):
        if 'schema' not in param_or_media_type:
            return value

        from openapi_core.unmarshalling.schemas.factories import (
            SchemaUnmarshallersFactory, )
        spec_resolver = self.spec.accessor.dereferencer.resolver_manager.\
            resolver
        unmarshallers_factory = SchemaUnmarshallersFactory(
            spec_resolver,
            self.format_checker,
            self.custom_formatters,
            context=context,
        )
        schema = param_or_media_type / 'schema'
        unmarshaller = unmarshallers_factory.create(schema)
        return unmarshaller(value)
コード例 #5
0
 def create_validator(schema):
     format_checker = build_format_checker()
     return SchemaUnmarshallersFactory(
         format_checker=format_checker).create(schema)
コード例 #6
0
 def create_unmarshaller(schema, custom_formatters=None, context=None):
     return SchemaUnmarshallersFactory(
         custom_formatters=custom_formatters, context=context).create(
             schema)
コード例 #7
0
 def create_validator(schema):
     return SchemaUnmarshallersFactory().create(schema)