document_validation.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:deckhand 作者: att-comdev 项目源码 文件源码
def get_schemas(cls, doc):
            """Retrieve the relevant schema based on the document's ``schema``.

            :param dict doc: The document used for finding the correct schema
                to validate it based on its ``schema``.
            :returns: A schema to be used by ``jsonschema`` for document
                validation.
            :rtype: dict
            """
            cls._register_data_schemas()

            # FIXME(fmontei): Remove this once all Deckhand tests have been
            # refactored to account for dynamic schema registeration via
            # ``DataSchema`` documents. Otherwise most tests will fail.
            for doc_field in [doc['schema'], doc['metadata']['schema']]:
                matching_schemas = cls._get_schema_by_property(
                    cls.schema_re, doc_field)
                if matching_schemas:
                    return matching_schemas

            return []
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号