Project

General

Profile

« Previous | Next » 

Revision 74bbdd9a

Added by koszko over 1 year ago

validate repository responses against JSON schemas

  • compute_scripts.awk (include_file): don't enforce specific path format on #INCLUDE'd files
  • .gitmodules, schemas: add Haketilo JSON schemas subrepo
  • html/install.js (InstallView): import schema validator and run it against downloaded mapping and resource definitions
  • html/repo_query.js (RepoEntry): import schema validator and run it against obtained query results
  • test/haketilo_test/unit/test_install.py (test_install_normal_usage, test_install_dialogs): use underscore instead of hyphen in item identifiers
  • test/haketilo_test/unit/test_install.py (test_install_dialogs): adapt error message test cases to new handling method of invalid JSON instanced
  • test/haketilo_test/unit/test_repo_query.py (test_repo_query_normal_usage): use underscore instead of hyphen in item identifiers
  • test/haketilo_test/unit/test_repo_query.py (test_repo_query_messages): use higher sample unsupported schema version to avoid having to modify the test case soon
  • test/haketilo_test/world_wide_library.py: use underscore instead of hyphen in item identifiers
  • common/jsonschema.js, common/jsonschema: adapt tdegrunt's jsonschema and include in Haketilo, load schema documents from schemas/

View differences:

test/haketilo_test/world_wide_library.py
127 127
    sample_resource_templates.append({
128 128
        'id_suffix':    ''.join(letters),
129 129
        'files_count':  deps[0],
130
        'dependencies': [{'identifier': f'resource_{l}'} for l in letters]
130
        'dependencies': [{'identifier': f'resource-{l}'} for l in letters]
131 131
    })
132 132

  
133 133
suffixes = [srt['id_suffix'] for srt in sample_resource_templates]
134 134
sample_resource_templates.append({
135 135
    'id_suffix':    '-'.join(suffixes),
136 136
    'files_count':  2,
137
    'dependencies': [{'identifier': f'resource_{suf}'} for suf in suffixes]
137
    'dependencies': [{'identifier': f'resource-{suf}'} for suf in suffixes]
138 138
})
139 139

  
140 140
for i in range(10):
......
150 150

  
151 151
for srt in sample_resource_templates:
152 152
    resource = make_sample_resource()
153
    resource['identifier']          = f'resource_{srt["id_suffix"]}'
153
    resource['identifier']          = f'resource-{srt["id_suffix"]}'
154 154
    resource['long_name']           = resource['identifier'].upper()
155 155
    resource['uuid']                = str(uuid4())
156 156
    resource['dependencies']        = srt['dependencies']
......
164 164
    resource_versions[1][-1] += 1
165 165

  
166 166
    mapping = make_sample_mapping()
167
    mapping['identifier']          = f'mapping_{srt["id_suffix"]}'
167
    mapping['identifier']          = f'mapping-{srt["id_suffix"]}'
168 168
    mapping['long_name']           = mapping['identifier'].upper()
169 169
    mapping['uuid']                = str(uuid4())
170 170
    mapping['source_copyright']    = resource['source_copyright']

Also available in: Unified diff