openknowledge-archive / dpr-api

DEPRECATED - Data Package Registry API and Frontend
http://frictionlessdata.io/
MIT License
7 stars 6 forks source link

Tagging with invalid fromatted tag should be forbidden - return 400 #242

Open Fak3 opened 7 years ago

Fak3 commented 7 years ago

As we will have to put tags into url at some point, I think we should impose some restrictions on the format of a valid tag.

This is up to be discussed. I think we should only allow a-zA-Z0-9._- and no spaces.

Acceptance criteria

Tasks

Analysis

In the function responsible for tagging we have code snippet

if 'version' not in data:
            return handle_error('ATTRIBUTE_MISSING', 'version not found', 400)

Meaning we are already returning 400 for other error.

Think we should use 400 for invalid Tagging as it usually used to indicate Bad Request. see https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#4xx_Client_errors So for ATTRIBUTE_MISSING we can use 404

zelima commented 7 years ago

Updated with acceptance criteria, tasks and analysis

rufuspollock commented 7 years ago

@zelima good work and much clearer.

One item: i don't understand the if 'version' not in data snippet - what is it doing and why would we change to 404? BTW we don't need different error codes for different errors - we just need different error messages.

Finally, could you estimate this issue.