Open soullivaneuh opened 3 years ago
Hmmm. I'm not sure I understand the issue. Are these the steps?
themeA
)themeA
, let's call it themeB
. This operation succeeds.themeB
to update only a few templates that existed before the upgrade of FusionAuth.Is that correct?
Not really:
sourceThemeId
)PATCH
resource to update only the templates we override.PATCH
resource will fail because of the missing new templates. But we don't override those templates, we should not need to supply them on a PATCH
method.
Is that better? :slightly_smiling_face:
Is this related to https://github.com/FusionAuth/fusionauth-issues/issues/441 ? templates
is an array, so we take what is presented (your list of old templates) and replace the entire array. But that doesn't contain the new templates, so validation fails.
Unable to patch a theme template when field are missing after an upgrade
Description
Some new release provide more templates to provide on the theme.
I have a setup script that will make a
POST /api/theme/${theme_id}
with thesourceThemeId
body parameter in order to have a copy of it.Then, I make a
PATCH /api/theme/${theme_id}
with only the templates to change as body parameters.However, this script does not work after an upgrade providing new template, because they are required even on the
PATCH
method.We can indeed see them on the admin panel:
Fix to provide
To me, a
PATCH
method should not required field we do not provide, this is how it works.However, if you need to keep this complete validation for some reasons, we may add the
sourceThemeId
on this method, telling to fill automatically the missing field with the default template.:warning: For the second option, the controller MUST changes only the empty templates, not the others.
Thanks for reading