diff --git a/src/app.py b/src/app.py index 777043a2..4171c030 100644 --- a/src/app.py +++ b/src/app.py @@ -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) diff --git a/src/schema/schema_validators.py b/src/schema/schema_validators.py index 81272c03..244277f6 100644 --- a/src/schema/schema_validators.py +++ b/src/schema/schema_validators.py @@ -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: @@ -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: