Repository navigation
Let Discovery rules give the enum values an API really uses - #485
Merged
Merged
Conversation
Some Discovery documents list enum values the API never sends or accepts: Search Console's lists SITE_OWNER and QUERY, while the API and its reference use siteOwner and query. The rules' new enumValues maps each listed value of a field to the API's value, or drops it. The generator stops when the API adds or removes a value, so the mapping stays complete.
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
widefleet-docs | 00e9feb | Nov 29 2026, 08:48 AM |
tnkuehne
added a commit
that referenced
this pull request
Nov 29, 2026
…ription (#473) ## Why Search performance and index status are a common input for internal apps and agents, and no template covers Google Search Console yet. Like Sheets and Calendar, it only needs rules on top of the discovery generator. ## What changes **Google Search Console template** (`templates/google-search-console`) - **Methods:** all ten methods of the Search Console API as typed methods with field selections: `searchanalyticsQuery`, `urlInspectionIndexInspect`, `sitesList`/`sitesGet`/`sitesAdd`/`sitesDelete` and `sitemapsList`/`sitemapsGet`/`sitemapsSubmit`/`sitemapsDelete`. - **Not offered:** `urlTestingTools.mobileFriendlyTest.run`. Google retired the Mobile-Friendly Test API in December 2023; the method is still in the description but returns no results. - **Approvals:** adding a property only adds it to the user's account and runs at once by default. Submitting a sitemap changes what Google crawls for every owner of the property and asks like an update. Removing properties and sitemaps asks. - **Scope:** `https://www.googleapis.com/auth/webmasters`, which adding and removing need and every other method accepts. An account connected with `webmasters.readonly` gets `permission_required`. - **Properties:** `siteUrl` and `feedpath` are passed as Search Console lists them (`sc-domain:example.com`, `https://example.com/`) and sent as one encoded path segment each. - **OAuth:** the organization's own Google OAuth client, like the other Google templates. - **Results:** `search_console_error` carries Google's message, status and reasons. Rate limits including daily quotas (`dailyLimitExceeded`), missing scopes, revoked tokens and responses over 8 MiB are handled like in the other Google templates. - **Enum values:** Google's description lists the enums of the properties, sitemaps and search analytics methods in capitals (`SITE_OWNER`, `QUERY`, `BY_PROPERTY`). The API sends the values its reference lists (`siteOwner`, `query`, `byProperty`, `hourly_all`), so the rules map them with `enumValues` from #485. URL inspection does use capitals and keeps them. Values the reference leaves out, such as the sitemap type `OCEANFRONT`, follow the other values' spelling. - **Filter lists:** `filterLists` takes only `country` and `device`, the dimensions Google supports for it. - **Icon:** Google's official Search Console icon. ## Not run live - `sitemapsSubmit` and `sitemapsDelete`. They use the same path encoding and empty-response handling as `sitesAdd` and `sitesDelete`, which ran live, and are covered by the template tests. ## Live run Run against a real Google account through a deployed copy of the template: - `sitesList`, `sitesGet`, `sitemapsList`: Google returns `siteOwner`, `siteFullUser`, sitemap type `sitemap` and content type `web`, the mapped values. - `searchanalyticsQuery` with `query`/`device` dimensions, `notContains` filter with non-ASCII text, `filterLists` by country, `type: "web"`, `aggregationType: "byProperty"`, `dataState: "all"`; and grouped by `hour` with `hourly_all`. Google returns `responseAggregationType: "byProperty"` and `metadata.firstIncompleteHour`, as the description names it. Requests with the description's capitals (`QUERY`, `BY_PROPERTY`) are accepted too; responses always use the mapped values. - `urlInspectionIndexInspect`: returns `PASS`, `ALLOWED`, `INDEXING_ALLOWED`, `SUCCESSFUL`, `MOBILE` in capitals, as the description lists them. - `sitesAdd` and `sitesDelete` with a non-ASCII property URL (`https://live-test-größe.widefleet.com/`): both return no data; Google stores the property under its punycode host and removes it again. - `sitemapsSubmit` asks first at the default level; declining returns `declined`. ## Tests - Template tests: connection, encoded property and sitemap URLs with non-ASCII text, search analytics and URL inspection, empty responses of adding, submitting and removing, approvals per level, Google's errors, rate limits, missing scopes, revoked tokens, refresh and disconnect. - Generator tests pass. Google returns the description's methods in a different order on each download, so regenerating reorders `src/api.ts` and `src/schema.ts` without changing their content. - Type tests: `permissionLevel === "siteOwner"` compiles; `"SITE_OWNER"`, `dimensions: ["QUERY"]` and a `query` filter list don't.
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.
Some Google Discovery documents list enum values that the API never sends or accepts. Search Console's description lists
SITE_OWNER,QUERYandHOURLY_ALL. The API and its reference usesiteOwner,queryandhourly_all. Generated types with the listed values reject the real ones, and app code that compares against them never matches.Change
enumValues: for eachSchema.field, every listed value maps to the value the API uses, or tonullwhen the API never uses it. A field of an array maps its items. Enum descriptions follow their values.hourly_allfollows no single pattern.Testing
templates/google-search-console(stacked above) uses the rule.