Skip to content

support json gem v3.x - #5492

Merged
kenhys merged 1 commit into
fluent:masterfrom
Watson1978:fix-json3-keyword-args
Sep 9, 2026
Merged

support json gem v3.x#5492
kenhys merged 1 commit into
fluent:masterfrom
Watson1978:fix-json3-keyword-args

Conversation

@Watson1978

@Watson1978 Watson1978 commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Which issue(s) this PR fixes:
Fixes #

What this PR does / why we need it:
json 3.0 dropped the positional options argument from JSON.parse, so every call passing Fluent::DEFAULT_JSON_PARSE_OPTIONS now fails with ArgumentError: wrong number of arguments (given 2, expected 1).
Ref. https://github.com/fluent/fluentd/actions/runs/34311091836

Pass the options as keyword arguments instead.

Docs Changes:
N/A

Release Note:

  • Support json gem v3.x

@Watson1978 Watson1978 added this to the v1.20.0 milestone Sep 9, 2026
@Watson1978

Copy link
Copy Markdown
Contributor Author

The codes in v1.19 brunch already have the same code.

record = JSON.parse(line, Fluent::DEFAULT_JSON_PARSE_OPTIONS)

json 3.0 dropped the positional options argument from JSON.parse, so
every call passing Fluent::DEFAULT_JSON_PARSE_OPTIONS now fails with
ArgumentError: wrong number of arguments (given 2, expected 1). This
breaks fluentd at startup because the config parser cannot read any
JSON literal.

Pass the options as keyword arguments instead, which works with both
json 2.21 and 3.0. JSON::ResumableParser still accepts a positional
hash, but switch it over as well so that the constant is always passed
the same way.

Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
@Watson1978
Watson1978 force-pushed the fix-json3-keyword-args branch from a7fe4a1 to 83e9a6a Compare September 9, 2026 05:49
@Watson1978 Watson1978 changed the title json: pass parse options as keyword arguments support json gem v3.x Sep 9, 2026
@Watson1978 Watson1978 added the backport to v1.19 We will backport this fix to the LTS branch label Sep 9, 2026
@Watson1978
Watson1978 requested a review from kenhys September 9, 2026 06:29
@kenhys
kenhys merged commit 2e91eb6 into fluent:master Sep 9, 2026
20 checks passed
@Watson1978
Watson1978 deleted the fix-json3-keyword-args branch September 9, 2026 07:15
Watson1978 added a commit that referenced this pull request Sep 9, 2026
json 3.0 dropped the positional options argument from JSON.parse, so
every call passing Fluent::DEFAULT_JSON_PARSE_OPTIONS now fails with
ArgumentError: wrong number of arguments (given 2, expected 1). This
breaks fluentd at startup because the config parser cannot read any
JSON literal.

Pass the options as keyword arguments instead, which works with both
json 2.18 and 3.0.

Backport of #5492. The JSON::ResumableParser changes are omitted since
that class is not used in this branch.

Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
Watson1978 added a commit that referenced this pull request Sep 9, 2026
**Which issue(s) this PR fixes**:
Fixes #

**What this PR does / why we need it**:
json 3.0 dropped the positional options argument from `JSON.parse`, so
every call passing `Fluent::DEFAULT_JSON_PARSE_OPTIONS` now fails with
`ArgumentError: wrong number of arguments (given 2, expected 1)`.
Ref. https://github.com/fluent/fluentd/actions/runs/34311091836

Pass the options as keyword arguments instead.

**Docs Changes**:
N/A

**Release Note**:
* Support json gem v3.x

Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
@Watson1978 Watson1978 added the backported "backport to LTS" is done label Sep 9, 2026
kenhys pushed a commit that referenced this pull request Sep 10, 2026
**Which issue(s) this PR fixes**:
Backport #5492 
Fixes #

**What this PR does / why we need it**:
json 3.0 dropped the positional options argument from `JSON.parse`, so
every call passing `Fluent::DEFAULT_JSON_PARSE_OPTIONS` now fails with
`ArgumentError: wrong number of arguments (given 2, expected 1)`. Ref.
https://github.com/fluent/fluentd/actions/runs/34311091836

Pass the options as keyword arguments instead.

**Docs Changes**:
N/A

**Release Note**:
* Support json gem v3.x

Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport to v1.19 We will backport this fix to the LTS branch backported "backport to LTS" is done

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants