Skip to content

Commit 32983d8

Browse files
Merge pull request #527 from supertokens/fix/changelog-with-migration-guide
fix: Update changelog with migration guide for form field value consumption
2 parents acabab0 + b1957da commit 32983d8

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

CHANGELOG.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,37 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313
- Adds support for form field related improvements by making fields accept any type of values
1414
- Adds support for optional fields to properly optional
1515

16+
### Migration
17+
18+
#### Convert type of value from form fields before using it
19+
20+
To read a value from formFields where id is `name`,
21+
22+
Before:
23+
24+
```python
25+
# form_fields should be of type List[FormField]
26+
name: str | None = None
27+
for field in form_fields:
28+
if field.id == 'name':
29+
name = field.value
30+
```
31+
32+
After:
33+
34+
```python
35+
# form_fields should be of type List[FormField]
36+
name: str | None = None
37+
for field in form_fields:
38+
if field.id == 'name':
39+
# Check type to ensure it's of type string
40+
value_to_consume = field.value
41+
if not isinstance(value_to_consume, str):
42+
# Throw error
43+
raise ValueError('name needs to be a string')
44+
name = str(value_to_consume)
45+
```
46+
1647
## [0.24.2] - 2024-09-03
1748
- Makes optional input form fields truly optional instead of just being able to accept `""`.
1849

0 commit comments

Comments
 (0)