Skip to content

Commit 9803fb8

Browse files
fix: Update changelog with migration guide for form field value consumption
1 parent 08844a5 commit 9803fb8

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

CHANGELOG.md

+34
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,40 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1818

1919
- Changes the type of `value` in `TypeFormField` to `interface{}` instead of `string` to add support for any type of value in form fields.
2020

21+
### Migration
22+
23+
#### Typecast value of form fields to expected type before using it
24+
25+
To read a value from formFields where id is `name`,
26+
27+
Before:
28+
29+
```go
30+
// formField should be of type []epmodels.TypeFormField
31+
var name string
32+
for id, value := range formFields {
33+
if id == "name" {
34+
name = value
35+
}
36+
}
37+
```
38+
39+
After:
40+
41+
```go
42+
// formField should be of type []epmodels.TypeFormField
43+
var name string
44+
for id, value := ranger formFields {
45+
if id == "name" {
46+
nameAsStr, asStrOk := value.(string)
47+
if !asStrOk {
48+
// Handle the error accordingly
49+
}
50+
name = nameAsStr
51+
}
52+
}
53+
```
54+
2155
## [0.24.2] - 2024-09-03
2256

2357
- Fixes memory leak with the JWKS cache.

0 commit comments

Comments
 (0)