Skip to content

feat(cli): opt in to request fields missing from Discovery - #931

Closed
ratovarius wants to merge 2 commits into
googleworkspace:mainfrom
ratovarius:feat/preview-schema-fields
Closed

feat(cli): opt in to request fields missing from Discovery#931
ratovarius wants to merge 2 commits into
googleworkspace:mainfrom
ratovarius:feat/preview-schema-fields

Conversation

@ratovarius

@ratovarius ratovarius commented Sep 11, 2026

Copy link
Copy Markdown

Description

Discovery can lag preview API fields, preventing requests such as Docs suggestions and anchored comments from reaching the service. Add --allow-unknown-fields to raw methods with JSON request bodies. Strict validation remains the default; opting in permits unknown properties recursively while preserving validation of known fields, required values, URLs, and file paths. Existing helper callers remain strict.

Related to #901 and #819.

Fixes ratovarius#1.

Scope and dependencies

This opt-in is useful when a service accepts request fields absent from its Discovery schema. It is optional; ordinary requests remain strict. It does not depend on the reader or either Python companion. As the branches currently stand, combining it with #935 conflicts where each adds a different helper/test in main.rs; combining it with #936 conflicts where both add README sections. These are shared insertion points; preserve both additions when refreshing the branches.

The only common code included from another contribution is the two-file Clippy fix proposed separately in #930. This PR contains its own copy, so it is self-contained against the current upstream base; it is not a zero-overlap diff. Prefer merging #930 first, then refreshing this branch to remove the duplicate. Each feature has its own changeset.

Validation

Formatting, all 795 Rust workspace tests, strict Clippy, build, and 17 real-binary dry-run acceptance checks passed. Tests cover recursive unknown properties, preserved known-field checks, command scope, payload preservation, and path/URL rejection.

Local independent agent review found no outstanding findings; upstream maintainer approval is still pending. Combined validation with the other contributions passed 859 Rust tests, 86 Python tests, 20 CLI acceptance checks, formatting, strict Clippy, and build.

Dry Run Output (synthetic fixture and placeholder IDs; no API request sent):

{
  "body": {
    "requests": [
      {
        "insertText": {
          "location": {
            "index": 1
          },
          "text": "Suggested text"
        }
      }
    ],
    "writeControl": {
      "writeMode": "SUGGEST"
    }
  },
  "dry_run": true,
  "is_multipart_upload": false,
  "method": "POST",
  "query_params": [],
  "url": "https://example.invalid/v1/documents/example%2Ddocument:batchUpdate"
}

Limits

Server authorization and Developer Preview enrollment still apply. No live preview document was modified. The captured output above uses a synthetic cached Discovery fixture intentionally missing preview properties; it proves payload preservation, not service acceptance.

Checklist

  • Follows AGENTS.md; no generated Google client crates.
  • Formatting check passed.
  • Required strict Clippy check passed.
  • Added regression tests for accepted and rejected cases.
  • Includes a changeset.

Add a method-scoped validation policy for raw JSON requests, preserving strict helper calls and validation of known fields. Cover recursive preview fields, dry runs, request serialization, and CLI scope with regression tests.
@changeset-bot

changeset-bot Bot commented Sep 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d07fec8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@googleworkspace/cli Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@googleworkspace-bot googleworkspace-bot added area: docs area: http area: core Core CLI parsing, commands, error handling, utilities labels Sep 11, 2026
@google-cla

google-cla Bot commented Sep 11, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@ratovarius

Copy link
Copy Markdown
Author

Closing this proposal by author request to focus the initial upstream contribution on #937 (preserve saved credentials after authentication failures).

This work remains implemented and maintained in the public fork, https://github.com/ratovarius/cli, with tracking in ratovarius#1 and integration in ratovarius#10. Further development of this item will continue in the fork. This closure does not indicate rejection by upstream maintainers.

@ratovarius ratovarius closed this Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: core Core CLI parsing, commands, error handling, utilities area: docs area: http

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow explicit use of fields absent from Discovery

2 participants