Skip to content
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

[backport -> release/3.8.x] fix(*): reject config if both deprecated and new field defined and their values mismatch #13594

Merged
merged 1 commit into from
Aug 29, 2024

Conversation

team-gateway-bot
Copy link
Collaborator

Automated backport to release/3.8.x, triggered by a label in #13565.

Original description

Summary

This PR adds a validation to deprecated fields that checks the case in which both new field and old field were defined; when that happens their values must match.

It introduces a new structure to deprecation definition by adding replaced_with information. This way field validation can verify if the replaced_with field has the same value as the old deprecated field. By default the comparison is done via translation through simple path but there might be instances where translation from old to new is more complicated and then the translation function should be provided in translation field.

The plan is to remove translate_backwards field in the future in favor of replaced_with.

Checklist

  • The Pull Request has tests
  • A changelog file has been created under changelog/unreleased/kong or skip-changelog label added on PR if changelog is unnecessary. README.md
  • There is a user-facing docs PR against https://github.com/Kong/docs.konghq.com - PUT DOCS PR HERE

Issue reference

KAG-5262

…eir values mismatch (#13565)

* fix(*): reject config if both deprecated and new field defined and their values mismatch

This commit adds a validation to deprecated fields
that checks if in case both new field and old field were defined -
their values must match.

Note that if one of the fields is null then the validation passes even
if the other is not null.

KAG-5262

* fixup! fix(*): reject config if both deprecated and new field defined and their values mismatch

PR fixes

* fixup! fix(*): reject config if both deprecated and new field defined and their values mismatch

PR fixes 2

(cherry picked from commit d10408c)
@kikito kikito merged commit d259e39 into release/3.8.x Aug 29, 2024
65 checks passed
@kikito kikito deleted the backport-13565-to-release/3.8.x branch August 29, 2024 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants