fix: handle duplicate OAuth scope enum variants (unblocks script API)#565
Merged
Byron merged 2 commits intoByron:mainfrom Jan 1, 2026
Merged
fix: handle duplicate OAuth scope enum variants (unblocks script API)#565Byron merged 2 commits intoByron:mainfrom
Byron merged 2 commits intoByron:mainfrom
Conversation
The code generator creates Rust enum variants from OAuth scope URLs by extracting the last path segment. When two scopes have the same final segment (e.g., `/calendar/feeds` and `/m8/feeds` both become `Feed`), this caused duplicate enum variants and compilation failures. This fix: 1. Removes `script` from the blacklist in shared.yaml (the original blocker comment about "Feed" type was actually about scope variants) 2. Adds deduplication logic to lib.mako that detects duplicate variant names and uses more path segments to disambiguate them For the Apps Script API, this changes: - `Feed` (calendar) -> `CalendarFeeds` - `Feed` (contacts) -> `M8Feeds` This unblocks generation of google-script1 v7.0.0. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Validated with `make script1-cargo ARGS=check`
f04f835 to
cc7794d
Compare
Owner
|
Thanks a lot, much appreciated! Please note that I regenerated the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes a code generation bug that caused duplicate Rust enum variants when OAuth scope URLs share the same final path segment. This unblocks generation of the
google-script1crate.Problem
The Apps Script API has two OAuth scopes:
https://www.google.com/calendar/feedshttps://www.google.com/m8/feedsThe generator extracts the last path segment (
feeds) and converts it to a CamelCase enum variant (Feed). Since both URLs have the same final segment, this created duplicate enum variants:This caused compilation to fail with
E0428: the name 'Feed' is defined multiple times.Solution
Removed
scriptfrom the blacklist inetc/api/shared.yamlFeed)" but this was misleading — it's about scope variants, not schema typesAdded deduplication logic to
src/generator/templates/api/lib/lib.makoResult
The generated code now has unique variant names:
Testing
google-script1successfullycargo checkpasses on the generated crate🤖 Generated with Claude Code