Skip to content

Commit

Permalink
Merge pull request #527 from supertokens/fix/changelog-with-migration…
Browse files Browse the repository at this point in the history
…-guide

fix: Update changelog with migration guide for form field value consumption
  • Loading branch information
rishabhpoddar authored Sep 27, 2024
2 parents acabab0 + b1957da commit 32983d8
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,37 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Adds support for form field related improvements by making fields accept any type of values
- Adds support for optional fields to properly optional

### Migration

#### Convert type of value from form fields before using it

To read a value from formFields where id is `name`,

Before:

```python
# form_fields should be of type List[FormField]
name: str | None = None
for field in form_fields:
if field.id == 'name':
name = field.value
```

After:

```python
# form_fields should be of type List[FormField]
name: str | None = None
for field in form_fields:
if field.id == 'name':
# Check type to ensure it's of type string
value_to_consume = field.value
if not isinstance(value_to_consume, str):
# Throw error
raise ValueError('name needs to be a string')
name = str(value_to_consume)
```

## [0.24.2] - 2024-09-03
- Makes optional input form fields truly optional instead of just being able to accept `""`.

Expand Down

0 comments on commit 32983d8

Please sign in to comment.