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

fix(db): ensure that flattened_errors is encoded as a JSON array #14019

Merged
merged 1 commit into from
Dec 18, 2024

Conversation

flrgh
Copy link
Contributor

@flrgh flrgh commented Dec 13, 2024

You know the deal: you create a list-like table but don't put anything in it, and all the sudden cjson thinks it's an object!

I wonder how many more times I'll fix this in my tenure at Kong 🤔

Well, this one is fixed. I even added a little helper function for it.

KAG-6032

@github-actions github-actions bot added core/db cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee labels Dec 13, 2024
@flrgh flrgh requested review from gszr, brentos, locao and gruceo December 16, 2024 18:11
Copy link
Member

@gszr gszr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch. Can we add a regression test for it?

@flrgh flrgh force-pushed the fix/flattened-errors-json-array branch from 381e87a to d1e4d43 Compare December 17, 2024 21:37
@flrgh flrgh force-pushed the fix/flattened-errors-json-array branch from d1e4d43 to 0f55428 Compare December 17, 2024 21:38
I wonder how many more times we'll have to fix this sorta thing...
@flrgh flrgh force-pushed the fix/flattened-errors-json-array branch from 0f55428 to cc023e8 Compare December 17, 2024 21:41
@flrgh
Copy link
Contributor Author

flrgh commented Dec 17, 2024

  1. Added a test for the cjson.encode(empty_table)
  2. Added a whole slew of unit tests by converting existing test cases in spec/02-integration/04-admin_api/15-off_spec.lua. This means we sort of have some duplicate test coverage, but the unit tests are fast and will aid future devs in understanding how declarative_config_flattened() processes its input.

@gszr gszr merged commit f7f7a23 into master Dec 18, 2024
26 checks passed
@gszr gszr deleted the fix/flattened-errors-json-array branch December 18, 2024 14:45
@team-gateway-bot
Copy link
Collaborator

Successfully created cherry-pick PR for master:

lhanjian pushed a commit that referenced this pull request Dec 23, 2024
)

* fix(db): ensure that flattened_errors is encoded as a JSON array (#14019)

(cherry picked from commit f7f7a23)

* chore(*): add copyright header

---------

Co-authored-by: Michael Martin <[email protected]>
Co-authored-by: Michael Martin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee core/db size/XXL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants