From 9803fb8a040b65f2d8baaf8f5a4ded546dde2d6d Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Fri, 27 Sep 2024 07:32:42 +0530 Subject: [PATCH] fix: Update changelog with migration guide for form field value consumption --- CHANGELOG.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index dda3ce99..d397b8a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,40 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Changes the type of `value` in `TypeFormField` to `interface{}` instead of `string` to add support for any type of value in form fields. +### Migration + +#### Typecast value of form fields to expected type before using it + +To read a value from formFields where id is `name`, + +Before: + +```go +// formField should be of type []epmodels.TypeFormField +var name string +for id, value := range formFields { + if id == "name" { + name = value + } +} +``` + +After: + +```go +// formField should be of type []epmodels.TypeFormField +var name string +for id, value := ranger formFields { + if id == "name" { + nameAsStr, asStrOk := value.(string) + if !asStrOk { + // Handle the error accordingly + } + name = nameAsStr + } +} +``` + ## [0.24.2] - 2024-09-03 - Fixes memory leak with the JWKS cache.