History

fix patch release data upgrades (#405)

Rhys Sullivan committed 6 months ago

Commit 1492de31 parent 28ea43c6 files · +166 −16Browse files

Showing the changes to packages/plugins/openapi/src (1 of 6 files). Show all

Unified · Split

packages/plugins/openapi/src/sdk/plugin.ts+12−4
@@ -795,8 +795,8 @@ export const openApiPlugin = definePlugin( · 794 unmodified lines
795795 name: existing.name,
796796 baseUrl: resolvedConfig.baseUrl,
797797 namespace: existing.namespace,
798− headers: existing.config.headers,
799− oauth2: existing.config.oauth2,
798+ headers: existing.legacy?.headers ?? existing.config.headers,
799+ oauth2: existing.legacy?.oauth2 ?? existing.config.oauth2,
800800 });
801801 });
802802
@@ -872,9 +872,17 @@ export const openApiPlugin = definePlugin( · 69 unmodified lines
872872 const existing = yield* ctx.storage.getSource(namespace, scope);
873873 if (!existing) return;
874874 const canonicalHeaders =
875− input.headers !== undefined ? canonicalizeHeaders(input.headers) : null;
875+ input.headers !== undefined
876+ ? canonicalizeHeaders(input.headers)
877+ : existing.legacy?.headers
878+ ? canonicalizeHeaders(existing.legacy.headers)
879+ : null;
876880 const canonicalOAuth2 =
877− input.oauth2 !== undefined ? canonicalizeOAuth2(input.oauth2) : null;
881+ input.oauth2 !== undefined
882+ ? canonicalizeOAuth2(input.oauth2)
883+ : existing.legacy?.oauth2
884+ ? canonicalizeOAuth2(existing.legacy.oauth2)
885+ : null;
878886 yield* ctx.storage.updateSourceMeta(namespace, scope, {
879887 name: input.name?.trim() || undefined,
880888 baseUrl: input.baseUrl,