Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4005,8 +4005,12 @@ def multiple_components():
validate_token_if_auth_header_exists(request)
# Get user token from Authorization header
user_token = get_user_token(request)
# Create a dictionary as required to use an entity validator. Ignore the
# options_dict['existing_entity_dict'] support for PUT requests, since this
# @app.route() only supports POST.
options_dict = {'http_request': request}
try:
schema_validators.validate_application_header_before_entity_create("Dataset", request)
schema_validators.validate_application_header_before_entity_create(options_dict=options_dict)
except Exception as e:
bad_request_error(str(e))
require_json(request)
Expand Down
16 changes: 8 additions & 8 deletions src/schema/schema_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@

Parameters
----------
normalized_type : str
One of the types defined in the schema yaml: Dataset, Upload
request: Flask request
The instance of Flask request passed in from application request
options_dict : dict
A dictionary of data needed by this entity-level validator based upon the create/POST or
update/PUT actions. The dictionary will always have 'http_request' and will have
'existing_entity_dict' for a PUT request.
"""
def validate_application_header_before_entity_create(options_dict):
if 'http_request' in options_dict:
Expand All @@ -52,10 +52,10 @@ def validate_application_header_before_entity_create(options_dict):

Parameters
----------
normalized_type : str
One of the types defined in the schema yaml: Dataset, Upload
request: Flask request
The instance of Flask request passed in from application request
options_dict : dict
A dictionary of data needed by this entity-level validator based upon the create/POST or
update/PUT actions. The dictionary will always have 'http_request' and will have
'existing_entity_dict' for a PUT request.
"""
def validate_entity_not_locked_before_update(options_dict):
if 'existing_entity_dict' in options_dict:
Expand Down