Project

General

Profile

« Previous | Next » 

Revision 73a443f5

Added by koszko over 1 year ago

improve loading of schema files

View differences:

tests/test_build.py
20 20
from jsonschema import ValidationError
21 21

  
22 22
from hydrilla import util as hydrilla_util
23
from hydrilla.util._util import _major_version_re
23
from hydrilla.util._util import _schema_name_re
24 24
from hydrilla.builder import build, _version, local_apt
25 25
from hydrilla.builder.common_errors import *
26 26

  
......
595 595
    Select the right JSON schema. Return without errors only if the instance
596 596
    validates against it.
597 597
    """
598
    major = _major_version_re.search(instance['$schema']).group('major')
598
    major = _schema_name_re.search(instance['$schema']).group('major')
599 599
    exact_schema_version = {'1': '1.0.1', '2': '2'}[major]
600 600
    schema_filename = f'{as_what}-{exact_schema_version}.schema.json'
601 601
    hydrilla_util.validator_for(schema_filename).validate(instance)

Also available in: Unified diff