gleanwork / gleanwork/glean-agent-toolkit
Google Workspace Custom Actions: oneOf schema issue + documentation contradiction
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 65
- Forks
- 12
- PR merge metrics
- No merged PRs in 30d
Description
Summary
I've been building custom actions for Google Docs Update and Google Slides batchUpdate endpoints. Hit a few issues that I think are worth documenting since they affect anyone building Google Workspace custom actions.
1. oneOf / Union Field Error
Google's batchUpdate APIs (Docs, Slides) use Protocol Buffer oneof semantics. Each item in the requests array must contain exactly ONE operation type (e.g. insertText OR replaceAllText, not both).
The Google Docs Update example in Glean's developer docs defines insertText and replaceAllText as sibling properties on the same request object. There's no schema-level enforcement of mutual exclusivity. The LLM sometimes populates both fields in one request item, which Google rejects with:
Invalid value at 'requests[0]' (oneof), oneof field 'request' is already set. Cannot set 'replaceAllText'
Workaround: Add explicit descriptions on the request object telling the LLM to include only one operation per array item. Works, but it's relying on natural language instead of schema constraints.
2. "No Nested Fields" Documentation Contradiction
The Creating Actions guide states: "No nested fields (only string/number/integer/boolean or arrays of these types)."
But the Google Docs Update example (published by Glean) nests objects 3-4 levels deep (requests[].insertText.location.index) and works fine. This is confusing for anyone trying to build custom actions -- it's unclear whether the flat-field constraint applies to all actions or only certain types.
3. $ref / components/schemas
Related to the above: the Jira example uses $ref and components/schemas for response schemas. It's unclear whether $ref is supported for request body schemas. The Google Docs example avoids $ref entirely and defines everything inline. Would be helpful to know if this is intentional or incidental.
4. Google Slides -- No Native Action Exists
There are no built-in or example actions for Google Slides. I built a custom action for presentations.batchUpdate supporting replaceAllText (template placeholder swaps) and insertText (content insertion by objectId). Happy to share the spec if useful.
Questions
- Is the "no nested fields" constraint enforced at the platform level, or is it guidance for custom action servers specifically?
- Does Glean's OpenAPI parser resolve
$refpointers in request body schemas? - Any plans for native Google Slides actions?
Environment
- Glean custom actions via OpenAPI 3.0 specs
- Google Docs API v1 (documents.batchUpdate)
- Google Slides API v1 (presentations.batchUpdate)
- OAuth 2.0 user authentication
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing the Creating Actions guide with the Google Docs Update and Jira examples linked in the issue, then verify the OpenAPI 3.0 request-schema behavior in the toolkit. Document whether nested fields and $ref are supported, clarify the oneOf limitation, and state whether Google Slides actions are planned; done means each question has an authoritative answer and the contradictory guidance is corrected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- google-cloud, openapi
- Domain
- api, documentation
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100