no need to check for json schema for metadata
@@ -945,11 +945,6 @@ def update_model_instance_metadata_json(request, file_type_id, **kwargs):
# Note: decorator 'authorise_for_aggregation_edit' sets the logical_file key in kwargs
logical_file = kwargs['logical_file']
metadata = logical_file.metadata
- if metadata.executed_by is None or not metadata.executed_by.mi_schema_json:
- msg = "No metadata schema is available for validation of metadata"
- error_response = {"status": "error", "message": msg}
- return JsonResponse(error_response, status=status.HTTP_400_BAD_REQUEST)
-
metadata_json_str = request.POST['metadata_json']
try:
metadata_json = json.loads(metadata_json_str)
@@ -960,7 +955,7 @@ def update_model_instance_metadata_json(request, file_type_id, **kwargs):
# validate json data against metadata schema:
try:
- metadata_json_schema = metadata.executed_by.mi_schema_json
+ metadata_json_schema = metadata.metadata_schema_json
jsonschema.Draft4Validator(metadata_json_schema).validate(metadata_json)
except jsonschema.ValidationError as ex:
msg = "JSON metadata is not valid as per the associated metadata schema {}".format(str(ex))
