* [verified] Fix Google Photos upload endpoint * Preserve MCP HEAD response metadata ---------
Showing the changes to packages/plugins/openapi/src (2 of 9 files). Show all
Unified · Split
| @@ -491,6 +491,42 @@ it.effect("marks Google Discovery media-download methods as binary responses", ( · 490 unmodified lines | |||
| 491 | }), | 491 | }), |
| 492 | ); | 492 | ); |
| 493 | 493 | ||
| 494 | it.effect("uses the versioned Google Photos raw upload endpoint", () => | ||
| 495 | Effect.gen(function* () { | ||
| 496 | const result = yield* convertGoogleDiscoveryToOpenApi({ | ||
| 497 | discoveryUrl: "https://www.googleapis.com/discovery/v1/apis/photoslibrary/v1/rest", | ||
| 498 | // @effect-diagnostics-next-line preferSchemaOverJson:off | ||
| 499 | documentText: JSON.stringify({ | ||
| 500 | name: "photoslibrary", | ||
| 501 | version: "v1", | ||
| 502 | title: "Google Photos Library API", | ||
| 503 | rootUrl: "https://photoslibrary.googleapis.com/", | ||
| 504 | servicePath: "", | ||
| 505 | auth: { | ||
| 506 | oauth2: { | ||
| 507 | scopes: { | ||
| 508 | "https://www.googleapis.com/auth/photoslibrary.appendonly": { | ||
| 509 | description: "Upload to Google Photos", | ||
| 510 | }, | ||
| 511 | }, | ||
| 512 | }, | ||
| 513 | }, | ||
| 514 | resources: {}, | ||
| 515 | schemas: {}, | ||
| 516 | }), | ||
| 517 | }); | ||
| 518 | |||
| 519 | const spec = decodeConvertedSpec(result.specText); | ||
| 520 | const upload = spec.paths["/v1/uploads"]?.post; | ||
| 521 | expect(upload).toMatchObject({ | ||
| 522 | operationId: "photoslibrary.mediaItems.upload", | ||
| 523 | "x-executor-toolPath": "photoslibrary.mediaItems.upload", | ||
| 524 | "x-executor-pathTemplate": "/v1/uploads", | ||
| 525 | servers: [{ url: "https://photoslibrary.googleapis.com/" }], | ||
| 526 | }); | ||
| 527 | }), | ||
| 528 | ); | ||
| 529 | |||
| 494 | it.effect("supplies documented scopes when Picker Discovery omits auth metadata", () => | 530 | it.effect("supplies documented scopes when Picker Discovery omits auth metadata", () => |
| 495 | Effect.gen(function* () { | 531 | Effect.gen(function* () { |
| 496 | const result = yield* convertGoogleDiscoveryToOpenApi({ | 532 | const result = yield* convertGoogleDiscoveryToOpenApi({ |
| @@ -829,7 +829,7 @@ const GOOGLE_OAUTH_SECURITY_SCHEME = "googleOAuth2"; · 828 unmodified lines | |||
| 829 | const GOOGLE_PHOTOS_LIBRARY_SERVICE = "photoslibrary"; | 829 | const GOOGLE_PHOTOS_LIBRARY_SERVICE = "photoslibrary"; |
| 830 | const GOOGLE_PHOTOS_APPENDONLY_SCOPE = "https://www.googleapis.com/auth/photoslibrary.appendonly"; | 830 | const GOOGLE_PHOTOS_APPENDONLY_SCOPE = "https://www.googleapis.com/auth/photoslibrary.appendonly"; |
| 831 | const GOOGLE_PHOTOS_UPLOAD_TOOL_PATH = "photoslibrary.mediaItems.upload"; | 831 | const GOOGLE_PHOTOS_UPLOAD_TOOL_PATH = "photoslibrary.mediaItems.upload"; |
| 832 | const GOOGLE_PHOTOS_UPLOAD_PATH = "/uploads"; | 832 | const GOOGLE_PHOTOS_UPLOAD_PATH = "/v1/uploads"; |
| 833 | 833 | ||
| 834 | const isGooglePhotosService = (service: string): boolean => | 834 | const isGooglePhotosService = (service: string): boolean => |
| 835 | service === GOOGLE_PHOTOS_LIBRARY_SERVICE || service === GOOGLE_PHOTOS_PICKER_SERVICE; | 835 | service === GOOGLE_PHOTOS_LIBRARY_SERVICE || service === GOOGLE_PHOTOS_PICKER_SERVICE; |