Skip to content

fix: Update changelog with migration guide for form field value consumption #527

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading