api-gateway-openapi-spec-authoring
БесплатноЗапускает вложенные скриптыНе проверенWrites, migrates, and fixes OpenAPI specs for Google Cloud API Gateway. Use when converting an OpenAPI 2.0 (Swagger) spec to OpenAPI 3.x, writing a new…
от google★ 25 380 звёзд на GitHubОб этом скилле
API Gateway OpenAPI Spec Authoring
API Gateway accepts API configs in OpenAPI 2.0, 3.0.x, and 3.1.x. The Google extensions in OpenAPI 3.x have a different structure from the OpenAPI 2.0 extensions:
- A required root
x-google-api-managementblock names the backends. x-google-backendis a string that references one of these backends.- The JWT settings move into
x-google-auth. The metrics and quotas move intox-google-api-management.
Use this skill to migrate an OpenAPI 2.0 spec, write a new OpenAPI 3.x spec, or fix an API config that fails to create.
Usage Attribution
MUST READ: Before executing any gcloud, REST API, or MCP command, you
MUST read and follow the instructions in
Usage Attribution.
Prerequisites
- Install the tools:
- If the Google Cloud CLI is not installed, give the user the install guide. Do not install it yourself. Until it is installed, give the user the commands to run, and continue from the output that they paste. If the CLI is old, ask the user before you run
gcloud components update. Rationale: an old CLI can fail when it uploads an OpenAPI 3.x API config. - Install Python 3.10 or later and PyYAML for the validator script. A JSON spec does not need PyYAML. Ask the user before you install it.
pip install "PyYAML>=6.0,<7.0"
- If the Google Cloud CLI is not installed, give the user the install guide. Do not install it yourself. Until it is installed, give the user the commands to run, and continue from the output that they paste. If the CLI is old, ask the user before you run
- Authenticate, and select the project, billing, and location:
- Run
gcloud auth login. - Ask the user which project to use, and use that ID as
{project_id}. If no project exists, create one withgcloud projects create {project_id}. Pass--project={project_id}on everygcloudcommand. Do not change the default project of the user withgcloud config set project. - Make sure that an active billing account is linked to
{project_id}. API Gateway has a free monthly allowance of API calls, but it still needs an active billing account. For current prices, see API Gateway pricing. - Use
us-central1as the default--locationfor gateway commands. For the other supported regions, see API Gateway deployment model.
- Run
- Enable the required Google Cloud APIs:
gcloud services enable \ apigateway.googleapis.com \ servicemanagement.googleapis.com \ servicecontrol.googleapis.com \ --project={project_id} - Verify the IAM roles (use the most restrictive role for each step):
- To create and update the API, API configs, and gateways: API Gateway Admin (
roles/apigateway.admin) on{project_id}. - To run the
gcloud services enablecommands: Service Usage Admin (roles/serviceusage.serviceUsageAdmin) on{project_id}. - To reference the gateway service account in an API config: Service Account User (
roles/iam.serviceAccountUser) on{gateway_sa_email}. - For a Cloud Run backend that requires authentication: grant
{gateway_sa_email}the Cloud Run Invoker role (roles/run.invoker) on the service.
- To create and update the API, API configs, and gateways: API Gateway Admin (
Decision Matrix
| Task | Required Mechanism | Critical Guardrail | Detailed Reference |
|---|---|---|---|
Migrate an OpenAPI 2.0 (swagger: "2.0") config |
Convert the standard fields, then move each Google extension to its OpenAPI 3.x form. | A converter such as Swagger Editor leaves every x-google-* extension in its OpenAPI 2.0 form. It also writes servers without x-google-endpoint, so the API loses its base path. Rationale: API Gateway rejects most OpenAPI 2.0 extensions in a 3.x spec with The '{extension}' extension is only supported in OpenAPI 2.x. |
OpenAPI 2.0 to 3.x Migration |
| Route requests to backends | Root x-google-api-management.backends.{backend_name} + x-google-backend: {backend_name} at the root or on an operation |
Set pathTranslation on every backend. Rationale: the default is APPEND_PATH_TO_ADDRESS for a root x-google-backend, but CONSTANT_ADDRESS for an operation-level one. CONSTANT_ADDRESS sends every request to the address unchanged, and sends path parameters as query parameters. APPEND_PATH_TO_ADDRESS appends the full request path, with the base path. NEVER set x-google-backend on a path item: API Gateway rejects it. |
Extensions and Limits |
| Authenticate callers | JWT: type: oauth2 scheme with x-google-auth (issuer, jwksUri, audiences). API key: type: apiKey scheme with x-api-key in a header, or key or api_key in the query. |
API Gateway does not check OAuth scopes. In a security list, put an API key in every alternative (OR) or in none. NEVER put two JWT schemes in one requirement object (AND). Rationale: API Gateway rejects these combinations. If the user asks for one of the |
Установить api-gateway-openapi-spec-authoring в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл api-gateway-openapi-spec-authoring?
Writes, migrates, and fixes OpenAPI specs for Google Cloud API Gateway. Use when converting an OpenAPI 2.0 (Swagger) spec to OpenAPI 3.x, writing a new OpenAPI 3.x spec, or fixing a failed "gcloud api-gateway api-configs create", such as "extension is only supported in OpenAPI 2.x". Also use when quotas set with x-google-quota are never enforced, or when a backend receives path parameters as query parameters. Don't use for adding or debugging MCP tools (use api-gateway-mcp-server), adding or changing API key, JWT, or quota settings in a working spec, or backend lockdown (use api-gateway-backend-security-and-rate-limiting), failing requests or service account and concurrency errors (use api-gateway-troubleshooting), Cloud Endpoints, Apigee, or GKE Gateway API.
Как установить скилл api-gateway-openapi-spec-authoring?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл api-gateway-openapi-spec-authoring запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic