Skip to content

google-apis-core: ClientSecrets#to_json raises NameError #27757

Closed

Description

@OskarEichler

Google::APIClient::ClientSecrets#to_json calls Json.dump, but no Json constant exists, so the documented serialization method raises NameError.

Minimal reproduction on google-apis-core 1.2.5/current:

require "google/api_client/client_secrets"
Google::APIClient::ClientSecrets.new("installed" => {"client_id" => "id"}).to_json
# NameError: uninitialized constant Google::APIClient::ClientSecrets::Json

A focused correction uses JSON.generate(to_hash, *args), which also preserves the JSON.generate(secrets) callback signature. The candidate passes the focused model, 88 targeted examples, and the cumulative 509-example core suite on Ruby 4.0.6.

I found no open issue/PR overlap. I have a minimal patch ready and can submit it after maintainer acceptance per CONTRIBUTING. The source audit and candidate preparation used AI assistance; I reviewed and verified the result.

Activity

  1. self-assigned this
    on Sep 15, 2026
  2. torreypayne commented on Oct 1, 2026

    @torreypayne
    Member

    @OskarEichler Thanks for the report and the clear reproduction — confirmed on main.

    Please go ahead and open the PR. Your JSON.generate(to_hash, *args) approach is fine (to_hash.to_json(*args) is equivalent). Please title it fix: ... and add a spec covering to_json and JSON.generate(secrets).

  3. OskarEichler commented on Oct 2, 2026

    @OskarEichler
    ContributorAuthor

    Opened #28074 with the requested fix: title and regression specs for both direct to_json and JSON.generate(secrets). The 88 ClientSecrets examples and full 502-example core suite pass on Ruby 4.0.6. The PR records the legacy RuboCop startup limitation separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions