Skip to content

Commit 96b82c0

Browse files
authored
Firebase ML: fixed displayName and tags regexes to match changed backend requirements. (#459)
1 parent 05d4cc2 commit 96b82c0

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

firebase_admin/ml.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@
4949
_ML_ATTRIBUTE = '_ml'
5050
_MAX_PAGE_SIZE = 100
5151
_MODEL_ID_PATTERN = re.compile(r'^[A-Za-z0-9_-]{1,60}$')
52-
_DISPLAY_NAME_PATTERN = re.compile(r'^[A-Za-z0-9_-]{1,60}$')
53-
_TAG_PATTERN = re.compile(r'^[A-Za-z0-9_-]{1,60}$')
52+
_DISPLAY_NAME_PATTERN = re.compile(r'^[A-Za-z0-9_-]{1,32}$')
53+
_TAG_PATTERN = re.compile(r'^[A-Za-z0-9_-]{1,32}$')
5454
_GCS_TFLITE_URI_PATTERN = re.compile(
5555
r'^gs://(?P<bucket_name>[a-z0-9_.-]{3,63})/(?P<blob_name>.+)$')
5656
_RESOURCE_NAME_PATTERN = re.compile(

integration/test_ml.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,22 @@ def _random_identifier(prefix):
4242

4343

4444
NAME_ONLY_ARGS = {
45-
'display_name': _random_identifier('TestModel123_')
45+
'display_name': _random_identifier('TestModel_')
4646
}
4747
NAME_ONLY_ARGS_UPDATED = {
48-
'display_name': _random_identifier('TestModel123_updated_')
48+
'display_name': _random_identifier('TestModel_updated_')
4949
}
5050
NAME_AND_TAGS_ARGS = {
51-
'display_name': _random_identifier('TestModel123_tags_'),
51+
'display_name': _random_identifier('TestModel_tags_'),
5252
'tags': ['test_tag123']
5353
}
5454
FULL_MODEL_ARGS = {
55-
'display_name': _random_identifier('TestModel123_full_'),
55+
'display_name': _random_identifier('TestModel_full_'),
5656
'tags': ['test_tag567'],
5757
'file_name': 'model1.tflite'
5858
}
5959
INVALID_FULL_MODEL_ARGS = {
60-
'display_name': _random_identifier('TestModel123_invalid_full_'),
60+
'display_name': _random_identifier('TestModel_invalid_full_'),
6161
'tags': ['test_tag890'],
6262
'file_name': 'invalid_model.tflite'
6363
}

0 commit comments

Comments
 (0)