common.py 文件源码

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

项目:fabric8-analytics-common 作者: fabric8-analytics 项目源码 文件源码
def validate_analysis_result(context, ecosystem, package, version):
    """Validate results of the analysis."""
    res = context.response.json()
    # make sure analysis has finished
    assert res['finished_at'] is not None
    # we want to validate top-level analysis and worker results that have "schema" defined
    structures_to_validate = [res]
    for _, worker_result in res['analyses'].items():
        # TODO: in future we want to mandate that all workers have their schemas,
        #  so we'll remove the condition
        if 'schema' in worker_result:
            structures_to_validate.append(worker_result)

    for struct in structures_to_validate:
        schema = requests.get(struct['schema']['url']).json()
        jsonschema.validate(struct, schema)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号