Skip to content

refactor: make codeResponse fields optional (#907)#908

Merged
frano-m merged 1 commit into
fran/4793-authorization-code-flowfrom
fran/907-coderesponse-types
May 5, 2026
Merged

refactor: make codeResponse fields optional (#907)#908
frano-m merged 1 commit into
fran/4793-authorization-code-flowfrom
fran/907-coderesponse-types

Conversation

@frano-m
Copy link
Copy Markdown
Contributor

@frano-m frano-m commented May 1, 2026

Summary

  • Flip every field on CodeResponse from required string to optional, so the type reflects Google's actual code-flow callback contract (success vs error payloads have disjoint fields)
  • Trim CODE_RESPONSE test fixture down to the only field we actually populate

Stacked on top of #905 (which introduces CodeResponse); will rebase onto main once that lands.

Closes #907.

Test plan

  • npm run check-format clean
  • npm run lint clean
  • npm run test-compile clean
  • npm test — 47 suites, 392 tests pass

google's oauth code-flow callback returns either a success payload
(code, scope, state) or an error payload (error, error_description,
error_uri, state) — required strings on every field misrepresent the
contract. trim the test fixture down to the only field we actually
populate.

Closes #907

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the newly introduced Google OAuth authorization-code callback typing so it matches Google’s real-world “success vs error” payload shapes, and simplifies the related test fixture accordingly.

Changes:

  • Make all CodeResponse fields optional to reflect that success/error responses have disjoint fields.
  • Reduce the CODE_RESPONSE test fixture to only the populated code field.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/google/types.ts Loosens CodeResponse field requirements so omitted fields are correctly representable.
tests/googleService.test.ts Simplifies the code-flow callback fixture to match actual usage and the updated type.

@frano-m frano-m merged commit 7957b1d into fran/4793-authorization-code-flow May 5, 2026
6 checks passed
@frano-m frano-m deleted the fran/907-coderesponse-types branch May 5, 2026 02:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants