Loading...
Loading...
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), backend lockdown or HTTP 429 tuning (use api-gateway-backend-security-and-rate-limiting), Cloud Endpoints, Apigee, or GKE Gateway API.
npx skill4agent add google/skills api-gateway-openapi-spec-authoringx-google-api-managementx-google-backendx-google-authx-google-api-managementgcloudgcloudCLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:api-gateway-openapi-spec-authoring)"agent-skills/1.0 (skill:api-gateway-openapi-spec-authoring)User-Agentgcloud components updatepip install "PyYAML>=6.0,<7.0"gcloud auth logingcloud config set project {project_id}gcloud projects create {project_id}{project_id}us-central1--locationgcloud services enable \
apigateway.googleapis.com \
servicemanagement.googleapis.com \
servicecontrol.googleapis.com \
--project={project_id}roles/apigateway.admin{project_id}gcloud services enableroles/serviceusage.serviceUsageAdmin{project_id}roles/iam.serviceAccountUser{gateway_sa_email}{gateway_sa_email}roles/run.invoker| Task | Required Mechanism | Critical Guardrail | Detailed Reference |
|---|---|---|---|
Migrate an OpenAPI 2.0 ( | Convert the standard fields, then move each Google extension to its OpenAPI 3.x form. | A converter such as Swagger Editor leaves every | OpenAPI 2.0 to 3.x Migration |
| Route requests to backends | Root | Set | Extensions and Limits |
| Authenticate callers | JWT: | API Gateway does not check OAuth scopes. In a | Extensions and Limits |
| Add quotas | | NEVER rely on | Extensions and Limits |
| Set the base path and CORS | One | API Gateway ignores | Extensions and Limits |
Fix a failed | Match the error text to the error table, and fix the spec. | Fix the spec before you retry, unless the error is about IAM or another | API Config Errors |
| Expose operations as MCP tools | The | MCP adds rules for tool names, descriptions, and | - |
gcloud api-gateway gateways describe {gateway_id} --location={region} --project={project_id} --format="value(apiConfig)"projects/{project}/locations/global/apis/{api_id}/configs/{config_id}gcloud api-gateway api-configs describe {config_id} --api={api_id} --project={project_id} --view=FULL \
--format="value(openapiDocuments[0].document.contents)" | tr '_-' '/+' | base64 --decodetrbase64 --decode[0][1][2]openapi3.0.4typetype: ["string", "null"]operationIdresponses$refoperationIdresponsesoperationIdgetItemget-Item$refpython3 scripts/validate_apigw_openapi.py --spec={spec_file}1"status": "FAIL"{spec_file}0"status": "PASS"2pathTranslationallowCors$refapi-configs createx-google-allowoperationIdpathTranslationbackend_path_translationpath_parameters_as_queryAPPEND_PATH_TO_ADDRESSgcloud api-gateway api-configs create {new_config_id} \
--api={api_id} \
--openapi-spec={spec_file} \
--backend-auth-service-account={gateway_sa_email} \
--project={project_id}
gcloud api-gateway gateways update {gateway_id} \
--api={api_id} \
--api-config={new_config_id} \
--location={region} \
--project={project_id}gcloud api-gateway gateways create {gateway_id}gateways updateapi-configs creategcloud api-gateway apis describe {api_id} --project={project_id} --format="value(managedService)"gcloud services enable {managed_service} --project={project_id}api-configs createapi-configs creategateways updategcloud api-gateway gateways describe {gateway_id} --location={region} --project={project_id} --format="value(state,defaultHostname)"ACTIVEhttps://{default_hostname}{base_path}{path}404 Page not foundThe current request is not defined by this API.openapi3.0.x3.1.xx-google-managementx-google-endpointsx-google-api-namex-google-allowx-google-issuerx-google-api-management.backendsx-google-backendx-google-backendpathTranslationoperationIdresponsesin: pathrequired: truex-google-quotaserversx-google-endpointpython3 scripts/validate_apigw_openapi.py --spec={spec_file}"status": "PASS"0gcloud api-gateway gateways delete {gateway_id} --location={region} --project={project_id}
gcloud api-gateway api-configs delete {config_id} --api={api_id} --project={project_id}
gcloud api-gateway apis delete {api_id} --project={project_id}