Return 400 when name is more than 255 characters
APIs listed below are returning 500 error if you pass name more than 255 characters. 1. create resource_classes 2. update resource_classes Added maxLength check in schema to ensure name should not be more than 255 characters. Closes-Bug: #1648314 Change-Id: I4ae54f3061fe43d87a656088db1d2ae454eb8237
This commit is contained in:
parent
1795699bc3
commit
874e666e7a
|
@ -29,6 +29,7 @@ POST_RC_SCHEMA_V1_2 = {
|
|||
"name": {
|
||||
"type": "string",
|
||||
"pattern": "^CUSTOM\_[A-Z0-9_]+$",
|
||||
"maxLength": 255,
|
||||
},
|
||||
},
|
||||
"required": [
|
||||
|
|
|
@ -195,3 +195,23 @@ tests:
|
|||
status: 400
|
||||
response_strings:
|
||||
- JSON does not validate
|
||||
|
||||
- name: try to create resource class with name exceed max characters
|
||||
POST: /resource_classes
|
||||
request_headers:
|
||||
content-type: application/json
|
||||
data:
|
||||
name: &name_exceeds_max_length_check CUSTOM_THIS_IS_A_LONG_TEXT_OF_LENGTH_256_CHARACTERSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
|
||||
status: 400
|
||||
response_strings:
|
||||
- "Failed validating 'maxLength'"
|
||||
|
||||
- name: try to update resource class with name exceed max characters
|
||||
PUT: /resource_classes/$ENVIRON['CUSTOM_RES_CLASS']
|
||||
request_headers:
|
||||
content-type: application/json
|
||||
data:
|
||||
name: *name_exceeds_max_length_check
|
||||
status: 400
|
||||
response_strings:
|
||||
- "Failed validating 'maxLength'"
|
||||
|
|
Loading…
Reference in New Issue