當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。