当前位置: 首页>>代码示例>>Python>>正文


Python RefResolver.from_schema方法代码示例

本文整理汇总了Python中jsonschema.RefResolver.from_schema方法的典型用法代码示例。如果您正苦于以下问题:Python RefResolver.from_schema方法的具体用法?Python RefResolver.from_schema怎么用?Python RefResolver.from_schema使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jsonschema.RefResolver的用法示例。


在下文中一共展示了RefResolver.from_schema方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: is_valid

# 需要导入模块: from jsonschema import RefResolver [as 别名]
# 或者: from jsonschema.RefResolver import from_schema [as 别名]
 def is_valid(self):
     handlers = {'https': self.session_request_json,
                 'http': self.session_request_json}
     resolver = RefResolver.from_schema(self.schema.raw_schema,
                                        handlers=handlers)
     try:
         validate(self.data, self.schema.raw_schema, resolver=resolver)
     except (SchemaError, ValidationError):
         return False
     return True
开发者ID:wpjunior,项目名称:pluct,代码行数:12,代码来源:resource.py

示例2: validate

# 需要导入模块: from jsonschema import RefResolver [as 别名]
# 或者: from jsonschema.RefResolver import from_schema [as 别名]
    def validate(self):
        """
        Validate that this instance matches its schema.

        """
        schema = Schema(self.__class__.SCHEMA)
        resolver = RefResolver.from_schema(
            schema,
            store=REGISTRY,
        )
        validate(self, schema, resolver=resolver)
开发者ID:globality-corp,项目名称:openapi,代码行数:13,代码来源:base.py

示例3: validate

# 需要导入模块: from jsonschema import RefResolver [as 别名]
# 或者: from jsonschema.RefResolver import from_schema [as 别名]
 def validate(self, instance, schema_id, skip_http=True):
     """
     Validate an instance against a registered schema.
     """
     schema = self[schema_id]
     handlers = {}
     if skip_http:
         handlers.update(
             http=do_not_resolve,
             https=do_not_resolve,
         )
     resolver = RefResolver.from_schema(
         schema,
         store=self,
         handlers=handlers,
     )
     return validate(instance, schema, resolver=resolver)
开发者ID:locationlabs,项目名称:jsonschema-types,代码行数:19,代码来源:registry.py

示例4: resolver

# 需要导入模块: from jsonschema import RefResolver [as 别名]
# 或者: from jsonschema.RefResolver import from_schema [as 别名]
 def resolver(self):
     return RefResolver.from_schema(Swagger(self).as_dict())
开发者ID:openmaraude,项目名称:APITaxi_utils,代码行数:4,代码来源:api.py

示例5: refresolver

# 需要导入模块: from jsonschema import RefResolver [as 别名]
# 或者: from jsonschema.RefResolver import from_schema [as 别名]
 def refresolver(self):
     if not self._refresolver:
         self._refresolver = RefResolver.from_schema(self.__schema__)
     return self._refresolver
开发者ID:Dlotan,项目名称:flask-restplus,代码行数:6,代码来源:api.py

示例6: test_it_can_construct_a_base_uri_from_a_schema_without_id

# 需要导入模块: from jsonschema import RefResolver [as 别名]
# 或者: from jsonschema.RefResolver import from_schema [as 别名]
 def test_it_can_construct_a_base_uri_from_a_schema_without_id(self):
     schema = {}
     resolver = RefResolver.from_schema(schema)
     self.assertEqual(resolver.base_uri, "")
     self.assertEqual(resolver.referrer, schema)
开发者ID:alexstrat,项目名称:jsonschema,代码行数:7,代码来源:tests.py

示例7: test_it_can_construct_a_base_uri_from_a_schema

# 需要导入模块: from jsonschema import RefResolver [as 别名]
# 或者: from jsonschema.RefResolver import from_schema [as 别名]
 def test_it_can_construct_a_base_uri_from_a_schema(self):
     schema = {"id" : "foo"}
     resolver = RefResolver.from_schema(schema)
     self.assertEqual(resolver.base_uri, "foo")
     self.assertEqual(resolver.referrer, schema)
开发者ID:alexstrat,项目名称:jsonschema,代码行数:7,代码来源:tests.py

示例8: validate_subschema

# 需要导入模块: from jsonschema import RefResolver [as 别名]
# 或者: from jsonschema.RefResolver import from_schema [as 别名]
def validate_subschema(data, schema_selector):
    schema = load_schema()
    resolver = RefResolver.from_schema(schema)
    format_checker = FormatChecker()
    request_schema = resolver.resolve_from_url(schema_selector)
    validate(data, request_schema, resolver=resolver, format_checker=format_checker)
开发者ID:MatchmakerExchange,项目名称:reference-server,代码行数:8,代码来源:__init__.py


注:本文中的jsonschema.RefResolver.from_schema方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。