Skip to content

Commit f37b403

Browse files
committed
🛂 Remove some field validators
Any field validators that may impact cheqd dids, schemas, rev reg ids, etc, are removed for the time being, in order to simplify migration from sov to cheqd. didx-xyz/acapy-cloud#1552
1 parent f1827e4 commit f37b403

30 files changed

+14
-875
lines changed

aries_cloudcontroller/models/conn_record.py

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -165,36 +165,6 @@ def invitation_mode_validate_enum(cls, value):
165165
raise ValueError("must be one of enum values ('once', 'multi', 'static')")
166166
return value
167167

168-
@field_validator("my_did")
169-
def my_did_validate_regular_expression(cls, value):
170-
"""Validates the regular expression"""
171-
if value is None:
172-
return value
173-
174-
if not re.match(
175-
r"^(did:(sov|indy):)?[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}$|^did:([a-zA-Z0-9_]+)(:[a-zA-Z0-9_.%-]+)?:([a-zA-Z0-9_.%-]+(:[a-zA-Z0-9_.%-]+)*)((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(\/[^#?]*)?([?][^#]*)?(\#.*)?$$",
176-
value,
177-
):
178-
raise ValueError(
179-
r"must validate the regular expression /^(did:(sov|indy):)?[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}$|^did:([a-zA-Z0-9_]+)(:[a-zA-Z0-9_.%-]+)?:([a-zA-Z0-9_.%-]+(:[a-zA-Z0-9_.%-]+)*)((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(\/[^#?]*)?([?][^#]*)?(\#.*)?$$/"
180-
)
181-
return value
182-
183-
@field_validator("their_did")
184-
def their_did_validate_regular_expression(cls, value):
185-
"""Validates the regular expression"""
186-
if value is None:
187-
return value
188-
189-
if not re.match(
190-
r"^(did:(sov|indy):)?[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}$|^did:([a-zA-Z0-9_]+)(:[a-zA-Z0-9_.%-]+)?:([a-zA-Z0-9_.%-]+(:[a-zA-Z0-9_.%-]+)*)((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(\/[^#?]*)?([?][^#]*)?(\#.*)?$$",
191-
value,
192-
):
193-
raise ValueError(
194-
r"must validate the regular expression /^(did:(sov|indy):)?[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}$|^did:([a-zA-Z0-9_]+)(:[a-zA-Z0-9_.%-]+)?:([a-zA-Z0-9_.%-]+(:[a-zA-Z0-9_.%-]+)*)((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(\/[^#?]*)?([?][^#]*)?(\#.*)?$$/"
195-
)
196-
return value
197-
198168
@field_validator("their_role")
199169
def their_role_validate_enum(cls, value):
200170
"""Validates the enum"""

aries_cloudcontroller/models/connection_static_request.py

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -65,36 +65,6 @@ class ConnectionStaticRequest(BaseModel):
6565
"their_verkey",
6666
]
6767

68-
@field_validator("my_did")
69-
def my_did_validate_regular_expression(cls, value):
70-
"""Validates the regular expression"""
71-
if value is None:
72-
return value
73-
74-
if not re.match(
75-
r"^(did:(sov|indy):)?[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}$",
76-
value,
77-
):
78-
raise ValueError(
79-
r"must validate the regular expression /^(did:(sov|indy):)?[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}$/"
80-
)
81-
return value
82-
83-
@field_validator("their_did")
84-
def their_did_validate_regular_expression(cls, value):
85-
"""Validates the regular expression"""
86-
if value is None:
87-
return value
88-
89-
if not re.match(
90-
r"^(did:(sov|indy):)?[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}$",
91-
value,
92-
):
93-
raise ValueError(
94-
r"must validate the regular expression /^(did:(sov|indy):)?[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}$/"
95-
)
96-
return value
97-
9868
@field_validator("their_endpoint")
9969
def their_endpoint_validate_regular_expression(cls, value):
10070
"""Validates the regular expression"""

aries_cloudcontroller/models/connection_static_result.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,6 @@ class ConnectionStaticResult(BaseModel):
5252
"their_verkey",
5353
]
5454

55-
@field_validator("my_did")
56-
def my_did_validate_regular_expression(cls, value):
57-
"""Validates the regular expression"""
58-
if not re.match(
59-
r"^(did:(sov|indy):)?[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}$",
60-
value,
61-
):
62-
raise ValueError(
63-
r"must validate the regular expression /^(did:(sov|indy):)?[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}$/"
64-
)
65-
return value
66-
6755
@field_validator("my_endpoint")
6856
def my_endpoint_validate_regular_expression(cls, value):
6957
"""Validates the regular expression"""
@@ -88,18 +76,6 @@ def my_verkey_validate_regular_expression(cls, value):
8876
)
8977
return value
9078

91-
@field_validator("their_did")
92-
def their_did_validate_regular_expression(cls, value):
93-
"""Validates the regular expression"""
94-
if not re.match(
95-
r"^(did:(sov|indy):)?[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}$",
96-
value,
97-
):
98-
raise ValueError(
99-
r"must validate the regular expression /^(did:(sov|indy):)?[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}$/"
100-
)
101-
return value
102-
10379
@field_validator("their_verkey")
10480
def their_verkey_validate_regular_expression(cls, value):
10581
"""Validates the regular expression"""

aries_cloudcontroller/models/credential_definition_send_request.py

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@
1515
from __future__ import annotations
1616

1717
import pprint
18-
import re
1918
from typing import Any, ClassVar, Dict, List, Optional, Set
2019

2120
import orjson
22-
from pydantic import BaseModel, Field, StrictBool, StrictStr, field_validator
21+
from pydantic import BaseModel, Field, StrictBool, StrictStr
2322
from typing_extensions import Annotated, Self
2423

2524
from aries_cloudcontroller.util import DEFAULT_PYDANTIC_MODEL_CONFIG
@@ -49,21 +48,6 @@ class CredentialDefinitionSendRequest(BaseModel):
4948
"tag",
5049
]
5150

52-
@field_validator("schema_id")
53-
def schema_id_validate_regular_expression(cls, value):
54-
"""Validates the regular expression"""
55-
if value is None:
56-
return value
57-
58-
if not re.match(
59-
r"^[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}:2:.+:[0-9.]+$",
60-
value,
61-
):
62-
raise ValueError(
63-
r"must validate the regular expression /^[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}:2:.+:[0-9.]+$/"
64-
)
65-
return value
66-
6751
model_config = DEFAULT_PYDANTIC_MODEL_CONFIG
6852

6953
def to_str(self) -> str:

aries_cloudcontroller/models/credential_definition_send_result.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@
1515
from __future__ import annotations
1616

1717
import pprint
18-
import re
1918
from typing import Any, ClassVar, Dict, List, Optional, Set
2019

2120
import orjson
22-
from pydantic import BaseModel, Field, field_validator
21+
from pydantic import BaseModel, Field
2322
from typing_extensions import Annotated, Self
2423

2524
from aries_cloudcontroller.util import DEFAULT_PYDANTIC_MODEL_CONFIG
@@ -35,18 +34,6 @@ class CredentialDefinitionSendResult(BaseModel):
3534
)
3635
__properties: ClassVar[List[str]] = ["credential_definition_id"]
3736

38-
@field_validator("credential_definition_id")
39-
def credential_definition_id_validate_regular_expression(cls, value):
40-
"""Validates the regular expression"""
41-
if not re.match(
42-
r"^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}):3:CL:(([1-9][0-9]*)|([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}:2:.+:[0-9.]+)):(.+)?$",
43-
value,
44-
):
45-
raise ValueError(
46-
r"must validate the regular expression /^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}):3:CL:(([1-9][0-9]*)|([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}:2:.+:[0-9.]+)):(.+)?$/"
47-
)
48-
return value
49-
5037
model_config = DEFAULT_PYDANTIC_MODEL_CONFIG
5138

5239
def to_str(self) -> str:

aries_cloudcontroller/models/credential_proposal.py

Lines changed: 1 addition & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@
1515
from __future__ import annotations
1616

1717
import pprint
18-
import re
1918
from typing import Any, ClassVar, Dict, List, Optional, Set
2019

2120
import orjson
22-
from pydantic import BaseModel, Field, StrictStr, field_validator
21+
from pydantic import BaseModel, Field, StrictStr
2322
from typing_extensions import Annotated, Self
2423

2524
from aries_cloudcontroller.models.credential_preview import CredentialPreview
@@ -60,76 +59,6 @@ class CredentialProposal(BaseModel):
6059
"schema_version",
6160
]
6261

63-
@field_validator("cred_def_id")
64-
def cred_def_id_validate_regular_expression(cls, value):
65-
"""Validates the regular expression"""
66-
if value is None:
67-
return value
68-
69-
if not re.match(
70-
r"^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}):3:CL:(([1-9][0-9]*)|([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}:2:.+:[0-9.]+)):(.+)?$",
71-
value,
72-
):
73-
raise ValueError(
74-
r"must validate the regular expression /^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}):3:CL:(([1-9][0-9]*)|([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}:2:.+:[0-9.]+)):(.+)?$/"
75-
)
76-
return value
77-
78-
@field_validator("issuer_did")
79-
def issuer_did_validate_regular_expression(cls, value):
80-
"""Validates the regular expression"""
81-
if value is None:
82-
return value
83-
84-
if not re.match(
85-
r"^(did:(sov|indy):)?[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}$",
86-
value,
87-
):
88-
raise ValueError(
89-
r"must validate the regular expression /^(did:(sov|indy):)?[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}$/"
90-
)
91-
return value
92-
93-
@field_validator("schema_id")
94-
def schema_id_validate_regular_expression(cls, value):
95-
"""Validates the regular expression"""
96-
if value is None:
97-
return value
98-
99-
if not re.match(
100-
r"^[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}:2:.+:[0-9.]+$",
101-
value,
102-
):
103-
raise ValueError(
104-
r"must validate the regular expression /^[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}:2:.+:[0-9.]+$/"
105-
)
106-
return value
107-
108-
@field_validator("schema_issuer_did")
109-
def schema_issuer_did_validate_regular_expression(cls, value):
110-
"""Validates the regular expression"""
111-
if value is None:
112-
return value
113-
114-
if not re.match(
115-
r"^(did:(sov|indy):)?[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}$",
116-
value,
117-
):
118-
raise ValueError(
119-
r"must validate the regular expression /^(did:(sov|indy):)?[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}$/"
120-
)
121-
return value
122-
123-
@field_validator("schema_version")
124-
def schema_version_validate_regular_expression(cls, value):
125-
"""Validates the regular expression"""
126-
if value is None:
127-
return value
128-
129-
if not re.match(r"^[0-9.]+$", value):
130-
raise ValueError(r"must validate the regular expression /^[0-9.]+$/")
131-
return value
132-
13362
model_config = DEFAULT_PYDANTIC_MODEL_CONFIG
13463

13564
def to_str(self) -> str:

aries_cloudcontroller/models/did.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,6 @@ class DID(BaseModel):
5757
"verkey",
5858
]
5959

60-
@field_validator("did")
61-
def did_validate_regular_expression(cls, value):
62-
"""Validates the regular expression"""
63-
if not re.match(
64-
r"^(did:(sov|indy):)?[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}$|^did:([a-zA-Z0-9_]+)(:[a-zA-Z0-9_.%-]+)?:([a-zA-Z0-9_.%-]+(:[a-zA-Z0-9_.%-]+)*)((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(\/[^#?]*)?([?][^#]*)?(\#.*)?$$",
65-
value,
66-
):
67-
raise ValueError(
68-
r"must validate the regular expression /^(did:(sov|indy):)?[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}$|^did:([a-zA-Z0-9_]+)(:[a-zA-Z0-9_.%-]+)?:([a-zA-Z0-9_.%-]+(:[a-zA-Z0-9_.%-]+)*)((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(\/[^#?]*)?([?][^#]*)?(\#.*)?$$/"
69-
)
70-
return value
71-
7260
@field_validator("key_type")
7361
def key_type_validate_enum(cls, value):
7462
"""Validates the enum"""

aries_cloudcontroller/models/did_endpoint.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,6 @@ class DIDEndpoint(BaseModel):
3636
)
3737
__properties: ClassVar[List[str]] = ["did", "endpoint"]
3838

39-
@field_validator("did")
40-
def did_validate_regular_expression(cls, value):
41-
"""Validates the regular expression"""
42-
if not re.match(
43-
r"^(did:(sov|indy):)?[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}$",
44-
value,
45-
):
46-
raise ValueError(
47-
r"must validate the regular expression /^(did:(sov|indy):)?[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}$/"
48-
)
49-
return value
50-
5139
@field_validator("endpoint")
5240
def endpoint_validate_regular_expression(cls, value):
5341
"""Validates the regular expression"""

aries_cloudcontroller/models/did_endpoint_with_type.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,6 @@ class DIDEndpointWithType(BaseModel):
4848
"mediation_id",
4949
]
5050

51-
@field_validator("did")
52-
def did_validate_regular_expression(cls, value):
53-
"""Validates the regular expression"""
54-
if not re.match(
55-
r"^(did:(sov|indy):)?[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}$",
56-
value,
57-
):
58-
raise ValueError(
59-
r"must validate the regular expression /^(did:(sov|indy):)?[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}$/"
60-
)
61-
return value
62-
6351
@field_validator("endpoint")
6452
def endpoint_validate_regular_expression(cls, value):
6553
"""Validates the regular expression"""

aries_cloudcontroller/models/didx_request.py

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@
1515
from __future__ import annotations
1616

1717
import pprint
18-
import re
1918
from typing import Any, ClassVar, Dict, List, Optional, Set
2019

2120
import orjson
22-
from pydantic import BaseModel, Field, StrictStr, field_validator
21+
from pydantic import BaseModel, Field, StrictStr
2322
from typing_extensions import Annotated, Self
2423

2524
from aries_cloudcontroller.models.attach_decorator import AttachDecorator
@@ -64,21 +63,6 @@ class DIDXRequest(BaseModel):
6463
"label",
6564
]
6665

67-
@field_validator("did")
68-
def did_validate_regular_expression(cls, value):
69-
"""Validates the regular expression"""
70-
if value is None:
71-
return value
72-
73-
if not re.match(
74-
r"^(did:(sov|indy):)?[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}$|^did:([a-zA-Z0-9_]+)(:[a-zA-Z0-9_.%-]+)?:([a-zA-Z0-9_.%-]+(:[a-zA-Z0-9_.%-]+)*)((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(\/[^#?]*)?([?][^#]*)?(\#.*)?$$",
75-
value,
76-
):
77-
raise ValueError(
78-
r"must validate the regular expression /^(did:(sov|indy):)?[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}$|^did:([a-zA-Z0-9_]+)(:[a-zA-Z0-9_.%-]+)?:([a-zA-Z0-9_.%-]+(:[a-zA-Z0-9_.%-]+)*)((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(\/[^#?]*)?([?][^#]*)?(\#.*)?$$/"
79-
)
80-
return value
81-
8266
model_config = DEFAULT_PYDANTIC_MODEL_CONFIG
8367

8468
def to_str(self) -> str:

aries_cloudcontroller/models/indy_cred_abstract.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -52,37 +52,13 @@ class IndyCredAbstract(BaseModel):
5252
"schema_id",
5353
]
5454

55-
@field_validator("cred_def_id")
56-
def cred_def_id_validate_regular_expression(cls, value):
57-
"""Validates the regular expression"""
58-
if not re.match(
59-
r"^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}):3:CL:(([1-9][0-9]*)|([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}:2:.+:[0-9.]+)):(.+)?$",
60-
value,
61-
):
62-
raise ValueError(
63-
r"must validate the regular expression /^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}):3:CL:(([1-9][0-9]*)|([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}:2:.+:[0-9.]+)):(.+)?$/"
64-
)
65-
return value
66-
6755
@field_validator("nonce")
6856
def nonce_validate_regular_expression(cls, value):
6957
"""Validates the regular expression"""
7058
if not re.match(r"^[0-9]*$", value):
7159
raise ValueError(r"must validate the regular expression /^[0-9]*$/")
7260
return value
7361

74-
@field_validator("schema_id")
75-
def schema_id_validate_regular_expression(cls, value):
76-
"""Validates the regular expression"""
77-
if not re.match(
78-
r"^[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}:2:.+:[0-9.]+$",
79-
value,
80-
):
81-
raise ValueError(
82-
r"must validate the regular expression /^[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}:2:.+:[0-9.]+$/"
83-
)
84-
return value
85-
8662
model_config = DEFAULT_PYDANTIC_MODEL_CONFIG
8763

8864
def to_str(self) -> str:

0 commit comments

Comments
 (0)